diff --git a/module-client/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java b/module-client/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java index e89c9f72b..6b52aa06c 100644 --- a/module-client/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java +++ b/module-client/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java @@ -54,8 +54,10 @@ import org.apache.http.conn.params.ConnRoutePNames; * nor of system or browser proxy settings. */ public class DefaultHttpRoutePlanner implements HttpRoutePlanner { - - private ClientConnectionManager connectionManager; + + /** The connection manager, to get at the scheme registry. */ + protected ClientConnectionManager connectionManager; + public DefaultHttpRoutePlanner(ClientConnectionManager aConnManager) { setConnectionManager(aConnManager); diff --git a/module-client/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java b/module-client/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java index 6fa0c6798..c710c9ebe 100644 --- a/module-client/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java +++ b/module-client/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java @@ -63,19 +63,45 @@ import org.apache.http.conn.params.ConnRoutePNames; */ public class ProxySelectorRoutePlanner implements HttpRoutePlanner { - private ClientConnectionManager connectionManager; + /** The connection manager, to get at the scheme registry. */ + protected ClientConnectionManager connectionManager; + + /** The proxy selector to use, or null for system default. */ + protected ProxySelector proxySelector; + public ProxySelectorRoutePlanner(ClientConnectionManager aConnManager) { setConnectionManager(aConnManager); } - public void setConnectionManager(ClientConnectionManager aConnManager) { this.connectionManager = aConnManager; } + /** + * Obtains the proxy selector to use. + * + * @return the proxy selector, or null for the system default + */ + public ProxySelector getProxySelector() { + return this.proxySelector; + } + + + /** + * Sets the proxy selector to use. + * + * @param psel the proxy selector, or + * null to use the system default + */ + public void setProxySelector(ProxySelector psel) { + this.proxySelector = psel; + } + + + // non-javadoc, see interface HttpRoutePlanner public HttpRoute determineRoute(HttpHost target, HttpRequest request, @@ -138,7 +164,9 @@ public class ProxySelectorRoutePlanner implements HttpRoutePlanner { throws HttpException { // the proxy selector can be 'unset', so we better deal with null here - final ProxySelector psel = ProxySelector.getDefault(); + ProxySelector psel = this.proxySelector; + if (psel == null) + psel = ProxySelector.getDefault(); if (psel == null) return null;