java - Apache HTTP Client socks proxy -
i working @ web requests project , using apache http client library. try connect server (e.g. http://www.google.com) working socks v4/5 tested mozilla firefox problem never response. different errors...
here code snippet:
//httpclient defaulthttpclient http = new defaulthttpclient(); //a class defined me proxy proxy = bla bla; httphost host = new httphost(proxy.getip(), proxy.getport()); if (proxy.getusername() != null) { http.getcredentialsprovider().setcredentials( new authscope(proxy.getip(), proxy.getport()), new usernamepasswordcredentials(proxy.getusername(), proxy.getpassword())); } http.getparams().setparameter(connroutepnames.default_proxy, host); can tell proper way initiate comunnication through socks proxies? thanks!
note: code above works perfect http proxies.
http proxy , socks proxy has different protocols ( http://en.wikipedia.org/wiki/socks#comparison ). question: can thtis native java socket ( how can configure httpclient authenticate against socks proxy? ) or create own implementation on defaultclientconnectionoperator, here guide ( http://4devops.blogspot.com/2011/10/httphttps-over-socks-proxy-with-java.html )
Comments
Post a Comment