@Override
    public HttpHost getHopTarget(final int hop) {
        Args.notNegative(hop, "Hop index");
        final int hopcount = getHopCount();
        Args.check(hop < hopcount, "Hop index exceeds tracked route length");
        HttpHost result = null;
        if (hop < hopcount - 1) {
            result = this.proxyChain[hop];
        } else {
            result = this.targetHost;
        }

        return result;
    }
Tracks layering a protocol.

@param secure    {@code true} if the route is secure,
                 {@code false} otherwise
httpclient5/src/main/java/org/apache/hc/client5/http/RouteTracker.java