本文介绍了如何配置HTTPClient以对SOCKS代理进行身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要针对SOCKS代理设置代理身份验证。
我发现了提供了似乎适用于常见HTTP代理的说明。
I need to set up proxy authentication against a SOCKS proxy.I found out this post giving instructions that appear to work with common HTTP proxies.
httpclient.getHostConfiguration().setProxy("proxyserver.example.com", 8080);
HttpState state = new HttpState();
state.setProxyCredentials(new AuthScope("proxyserver.example.com", 8080),
new UsernamePasswordCredentials("username", "password"));
httpclient.setState(state);
这也适用于 SOCKS 代理或我是否必须这样做不同的东西?
Would that work with SOCKS proxies as well or do I have to do something different?
推荐答案
说:
使用透明,我猜他们的意思是它可以在没有你需要的情况下工作做任何特别的事。你在某处有SOCKS代理吗?难道你不能试一试看它是否有效吗?
With "transparent", I guess they mean that it works without you needing to do anything special. Do you have a SOCKS proxy available somewhere? Can't you just try it out to see if it works?
这篇关于如何配置HTTPClient以对SOCKS代理进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!