Properties prop = System.getProperties();
 prop.setProperty("http.proxyHost", "localhost");
 // 设置http访问要使用的代理服务器的端口
 prop.setProperty("http.proxyPort", "8118");

 

    Properties props = System.getProperties();
     props.setProperty("proxySet", "true");
     props.setProperty("http.proxyHost", "172.30.96.35");
     props.setProperty("http.proxyPort", "8080");
     props.setProperty("http.proxyUser", "uatxm990375");
     props.setProperty("http.proxyPassword", "Iccc2016");   

      URL url = new URL("http://www.baidu.com");
      InputStream in = url.openConnection().getInputStream();
      //方法二
      /*URL url = new URL("http://www.baidu.com");
      InputStream in = url.openStream();*/

 

相关文章:

  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-21
  • 2021-11-27
  • 2021-12-23
  • 2021-06-17
猜你喜欢
  • 2022-12-23
  • 2021-05-12
  • 2022-01-15
  • 2021-06-26
  • 2022-12-23
相关资源
相似解决方案