首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

HttpURLConnection施用代理服务器

2012-12-19 
HttpURLConnection使用代理服务器Authenticator.setDefault(new SimpleAuthenticator(username,password))

HttpURLConnection使用代理服务器

Authenticator.setDefault(new SimpleAuthenticator(username,password));
Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost",proxy);
systemProperties.setProperty("http.proxyPort",port);
HttpURLConnection connection = (HttpURLConnection)server.openConnection();
connection.connect();

热点排行