Thanks Oleg. I am desperately looking for solution around this. Basically, this has been part of our product for a while and being used in multiple areas. So if i need to change to a newer version, there will be too many reference changes to cater to.
I will be changing it, but need more cycle for that, which at this moment i don't have. As for trying out with one of the latest versions, i downloaded httpclient 4.3.3, this would be the latest. Ran the example code in "ClientExecuteProxy.java". Just replaced the target value from "localhost" to "issues.apache.org". Test 1 - Commented the proxy bit. The example ran successfully. Test 2 - Uncommented the proxy part, failed with the same error as in 4.0.1. So i don't think this is something to do with the latest version. Getting the following exception in console when i run it, Executing request GET / HTTP/1.1 to https://issues.apache.org:443 via http://127.0.0.1:8080 Mar 14, 2014 5:56:05 PM org.apache.http.impl.execchain.RetryExec execute INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:8080->https://issues.apache.org:443: The target server failed to respond Mar 14, 2014 5:56:05 PM org.apache.http.impl.execchain.RetryExec execute INFO: Retrying request to {tls} ->http://127.0.0.1:8080->https://issues.apache.org:443 Mar 14, 2014 5:56:06 PM org.apache.http.impl.execchain.RetryExec execute INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:8080->https://issues.apache.org:443: The target server failed to respond Mar 14, 2014 5:56:06 PM org.apache.http.impl.execchain.RetryExec execute INFO: Retrying request to {tls} ->http://127.0.0.1:8080->https://issues.apache.org:443 Mar 14, 2014 5:56:07 PM org.apache.http.impl.execchain.RetryExec execute INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:8080->https://issues.apache.org:443: The target server failed to respond Mar 14, 2014 5:56:07 PM org.apache.http.impl.execchain.RetryExec execute INFO: Retrying request to {tls} ->http://127.0.0.1:8080->https://issues.apache.org:443 Exception in thread "main" org.apache.http.NoHttpResponseException: issues.apache.org:443 failed to respond at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138) at com.sun.proxy.$Proxy0.receiveResponseHeader(Unknown Source) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123) at org.apache.http.impl.execchain.MainClientExec.createTunnelToTarget(MainClientExec.java:455) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:115) at com.httpclient3.TestClient.main(TestClient.java:41) Note - For proxy, i am using tcpmon in proxy mode (no security) just specifying the listen port. I have posted my detailed code and usecase in stackover flow if you need any references - http://stackoverflow.com/questions/22343149/apache-http-client-4-0-1-ssl-proxy or to my earlier post of this user lists. Additionally in TCPmon(proxy), the HTTP communication observed was, Incoming request CONNECT issues.apache.org:443 HTTP/1.1 Response from the proxy java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at java.net.Socket.<init>(Socket.java:425) at java.net.Socket.<init>(Socket.java:208) at org.apache.ws.commons.tcpmon.Connection.run(Connection.java:372) I hope this will provide you sufficient details to check whats going wrong. Either the example are not working out of the box or i am not doing something right. Thanks, Vikram On Fri, Mar 14, 2014 at 4:15 PM, Oleg Kalnichevski <[email protected]> wrote: > On Thu, 2014-03-13 at 21:07 +0530, Vicky wrote: > > Hi, > > > > I am using HttpClient 4.0.1. And trying to get proxy working with my SSL > > based http client. Unfortunately i haven't been successful so far. > > > > Could get a not secure http proxy working, but the problem is with https. > > > > Can you provide any pointers to doing this. > > > > I am using the following code for setting the proxy, > > > > HttpHost proxy = new HttpHost("localhost", 5555); > > > > httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, > proxy); > > > > Any help is greatly appreciated. > > > > Thanks, > > Vicky > > I responded to your previous message but for some reason my response got > lost in transit. > > First off, is there a reason why you are using such an outdated version > of HttpClient? Even if for some inexplicable reasons you need full 4.0 > compatibility at the very least upgrade to 4.0.3. After that please run > your code with wire / context logging on and post a log of the session > to this list. > > http://hc.apache.org/httpcomponents-client-4.3.x/logging.html > > Oleg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
