我使用 100% 工作袜子,但无法通过我的应用程序连接。
SocketAddress proxyAddr = new InetSocketAddress("1.1.1.1", 12345);
Proxy pr = new Proxy(Proxy.Type.SOCKS, proxyAddr);
try
{
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(pr);
con.setConnectTimeout(proxyTimeout * 1000);
con.setReadTimeout(proxyTimeout * 1000);
con.connect();
System.out.println(con.usingProxy());
}
catch(IOException ex)
{
Logger.getLogger(Enter.class.getName()).log(Level.SEVERE, null, ex);
}
那么我做错了什么?如果我将 HTTP 与一些 HTTP 代理一起使用,那么一切都可以正常工作,但不能与 SOCKS 一起使用。