public void tunnelProxy(final HttpHost proxy, final boolean secure) {
        Args.notNull(proxy, "Proxy host");
        Asserts.check(this.connected, "No tunnel unless connected");
        Asserts.notNull(this.proxyChain, "No tunnel without proxy");
        // prepare an extended proxy chain
        final HttpHost[] proxies = new HttpHost[this.proxyChain.length + 1];
        System.arraycopy(this.proxyChain, 0,
                proxies, 0, this.proxyChain.length);
        proxies[proxies.length - 1] = proxy;

        this.proxyChain = proxies;
        this.secure = secure;
    }
Tracks tunnelling to a proxy in a proxy chain.
This will extend the tracked proxy chain, but it does not mark
the route as tunnelled. Only end-to-end tunnels are considered there.

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