【发布时间】:2016-05-11 07:19:09
【问题描述】:
我正在尝试通过 Socks5 使用代理打开页面 URL(已在服务器端创建)
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.1", 8080));
conn = new URL(urlString).openConnection(proxy);
//Connection
Authenticator authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication("user",
"password".toCharArray()));
}
};
Authenticator.setDefault(authenticator);
现在我需要使用此代理连接打开(和关闭选项?)一个 URL...
【问题讨论】: