java用代理访问

 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();*/
上一篇:day14 Python集合关系运算交,差,并集


下一篇:c++find函数用法