29 thg 8, 2011

Set proxy cho HttpURLConnection


String proxy = "proxy.mydomain.com",
port = "8080"
;
URL url = new URL( "http://www.google.com/" );
Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost",proxy);
systemProperties.setProperty("http.proxyPort",port);

HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.connect();

Không có nhận xét nào:

Đăng nhận xét

Related Posts Plugin for WordPress, Blogger...