HttpURLConnection设置代理服务器
1、设置系统数据
System.setProperty("http.proxyHost", "proxy.com");System.setProperty("http.proxyPort", "80");URL url=new URL("http://someserver/somepage");URLConnection uc = url.openConnection ();String encoded = new String (Base64.base64Encode(new String("username:password").getBytes()));uc.setRequestProperty("Proxy-Authorization", "Basic " + encoded);uc.connect();