Thanks you very much Oleg. That works like a charm.
________________________________ From: Oleg Kalnichevski <[email protected]> To: HttpClient User Discussion <[email protected]> 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); socket.connect(dest); --- That is it. Hope this helps. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
