hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Gordineer <joshg...@yahoo.com>
Subject Re: Fw: SOCKS proxy example??
Date Wed, 21 Apr 2010 00:37:17 GMT
Thanks you very much Oleg.  That works like a charm.

From: Oleg Kalnichevski <olegk@apache.org>
To: HttpClient User Discussion <httpclient-users@hc.apache.org>
Sent: Tue, April 20, 2010 3:10:35 PM
Subject: Re: Fw: SOCKS proxy example??

On Tue, 2010-04-20 at 14:52 -0700, Josh Gordineer wrote:
> Thanks Oleg!!  Just to finish the thought, would I pass the JDK system parameters 'socksProxyHost'
and 'socksProxyPort' as parameters in the HttpParams object in the connectSocket() operation
on the SocketFactory?

Yes, you can use HttpParams to pass some custom configuration parameters
to your custom SocketFactory and create a Socket instance bound to a
SOCKS server.


String proxyHost = (String) params.getParameter("my.socks.proxy.host")
Integer portPort = (Integer) params.getParameter("my.socks.proxy.port")

SocketAddress addr = new InetSocketAddress(proxyHost, proxyPort);
Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
Socket socket = new Socket(proxy);
InetSocketAddress dest = new InetSocketAddress(host, port);

That is it. Hope this helps.


To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message