java 代理服务器 用户名 密码 407错误

Properties systemProperties = System.getProperties();

systemProperties.setProperty("http.proxyHost","192.168.10.240");

systemProperties.setProperty("http.proxyPort","8080");

HttpURLConnection conn =null;

boolean checkNext = true;

try

{

conn =(HttpURLConnection)new URL("http://m.weather.com.cn/data/101010900.html").openConnection();

String encoded = new String(Base64.encode(new String("kevin.ge:hellocarel5").getBytes()));

conn.setRequestProperty("Proxy-Authorization", "Basic " + encoded);

int result= conn.getResponseCode();

String re=conn.getResponseMessage();

if(result==HttpURLConnection.HTTP_OK)

{