System.setProperty("http.proxySet", "true");
System.setProperty("java.net.useSystemProxies", "true");
System.setProperty("http.proxyHost", "192.168.1.103");
System.setProperty("http.proxyPort", "3128");
System.setProperty("http.proxyUser", "user123");
System.setProperty("http.proxyPassword", "passwD123");
url = new URL("http://www.google.co.in");
每次
处理时,我使用此代码IOException异常抛出一个说HTTP响应代码407 HTTP 407意味着需要代理认证。为什么在我设置proxyUser和proxyPassword时出现此问题。
如果我输入了错误的密码,会发生http 401,但它总是给我407,这意味着我的代码不需要用户名和密码。在上面的代码中user123是用户名,passwD123是代理认证的密码。HTTP 407代理认证:如何在Java代码中
的HTTP客户端您使用的? – Cratylus
我正在尝试在java中制作手动代理,自动代理,无代理支持浏览器。像Firefox这样的浏览器支持这个,工具 - >选项 - >高级 - >网络 - >设置。 – dayitv89