diff -N -r -u httpclient.bak/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java --- httpclient.bak/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java 2014-05-31 11:09:08.000000000 -0400 +++ httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java 2014-06-18 12:22:11.947964951 -0400 @@ -656,6 +656,31 @@ } /** + * Produces an instance of {@link ClientExecChain} to be used as a main exec. + *
+ * Default implementation produces an instance of {@link MainClientExec} + *
+ * For internal use. + */ + protected ClientExecChain produceMainExec(final HttpRequestExecutor requestExec, + final HttpClientConnectionManager connManager, + final ConnectionReuseStrategy reuseStrategy, + final ConnectionKeepAliveStrategy keepAliveStrategy, + final AuthenticationStrategy targetAuthStrategy, + final AuthenticationStrategy proxyAuthStrategy, + final UserTokenHandler userTokenHandler) + { + return new MainClientExec( + requestExec, + connManager, + reuseStrategy, + keepAliveStrategy, + targetAuthStrategy, + proxyAuthStrategy, + userTokenHandler); + } + + /** * For internal use. */ protected ClientExecChain decorateMainExec(final ClientExecChain mainExec) { @@ -784,7 +809,7 @@ userTokenHandler = NoopUserTokenHandler.INSTANCE; } } - ClientExecChain execChain = new MainClientExec( + ClientExecChain execChain = produceMainExec( requestExec, connManager, reuseStrategy, diff -N -r -u httpclient.bak/src/main/java/org/apache/http/impl/execchain/MainClientExec.java httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java --- httpclient.bak/src/main/java/org/apache/http/impl/execchain/MainClientExec.java 2014-05-31 11:09:09.000000000 -0400 +++ httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java 2014-06-18 12:21:01.211592405 -0400 @@ -343,7 +343,7 @@ /** * Establishes the target route. */ - void establishRoute( + protected void establishRoute( final AuthState proxyAuthState, final HttpClientConnection managedConn, final HttpRoute route, @@ -421,7 +421,7 @@ * This method does not update the connection with * information about the tunnel, that is left to the caller. */ - private boolean createTunnelToTarget( + protected boolean createTunnelToTarget( final AuthState proxyAuthState, final HttpClientConnection managedConn, final HttpRoute route, @@ -510,7 +510,7 @@ * This method is not implemented in this class. * It just throws an exception here. */ - private boolean createTunnelToProxy( + protected boolean createTunnelToProxy( final HttpRoute route, final int hop, final HttpClientContext context) throws HttpException { @@ -526,8 +526,7 @@ throw new HttpException("Proxy chains are not supported."); } - - private boolean needAuthentication( + protected boolean needAuthentication( final AuthState targetAuthState, final AuthState proxyAuthState, final HttpRoute route, @@ -567,5 +566,4 @@ } return false; } - }