在JAVA中使用Socks5代理打开网页

时间:2016-05-11 07:19:09

标签: java proxy socks

我正在尝试通过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); 使用代理打开页面网址(已在服务器端创建)

<a href="https://www.google.com/maps/place/<?php echo $row['latlng']; ?>"> Link </a> . "</td>";

现在我需要使用此代理连接打开(并关闭选项?)URL ...

1 个答案:

答案 0 :(得分:0)

  

现在我需要使用此代理连接打开(并关闭选项?)URL ...

你已经这样做了。只需获取输入流并照常进行。

相关问题