hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Fw: SOCKS proxy example??
Date Tue, 20 Apr 2010 22:10:35 GMT
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

View raw message