hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravi C Chamarthy <ravi.chamar...@in.ibm.com>
Subject HTTPS Proxy using ProxySelectorRoutePlanner is not working as expected
Date Wed, 20 Feb 2013 03:22:06 GMT

Hi,

We use Apache HTTPClient to submit our requests to the target web
application hosted in WebSphere Liberty Application Server.
Scenario is to check HTTPS proxy with Apache HTTPClient.

I am using Fiddler2 as the HTTPS proxy and submitting the requests using
the Apache HTTPClient API.
And as mentioned in
[ http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e571 ]
 the following snippet works well where the requests are routed to the
proxy.
Here in the below code snippet the port 8888 is the fiddler port number and
the application server port is 9944.

DefaultHttpClient httpclient = new DefaultHttpClient();
HttpHost proxy = new HttpHost("localhost", 8888);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);


However, the actual requirement is to make use of the JRE proxy configured
at the system level, as detailed at:
[ http://www.java.com/en/download/help/proxy_setup.xml ], using which I
have setup the proxy as "locahost" and port as 8888.
I am using ProxySelector.getDefault() as mentioned in the code snippet from
[ http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e571 ].

DefaultHttpClient httpclient = new DefaultHttpClient();
ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
        httpclient.getConnectionManager().getSchemeRegistry(),
        ProxySelector.getDefault());
httpclient.setRoutePlanner(routePlanner);

But the issue is, the request always goes directly to the target
application server and not going via., the proxy.
Is there any further httpclient configuration that I have to do?

Thanks,
Ravi Chamarthy


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message