HttpUrlConnection socks5 代理问题

代码如下:
InetSocketAddress inetSocketAddress = new InetSocketAddress(proxyIp, 1080);
Proxy proxy = new Proxy(Proxy.Type.SOCKS, inetSocketAddress);
URL url = new URL("https://XXXX");
HttpURLConnection conn = (HttpURLConnection)url.openConnection(proxy);
conn.setRequestMethod("POST");

报错如下:
java.net.SocketException: SOCKS : authentication failed
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

如何设置不需要用户密码验证。求大神!!!
查看全部
qiuchuanqing
qiuchuanqing
2015/08/18 09:45
  • httpurlconnection
  • socks5
  • 点赞
  • 收藏
  • 回答
    私信

1个回复