java 程序署理设置

java 程序代理设置
		URL url;
		System.setProperty("http.proxyHost", "192.168.1.1");
		System.setProperty("http.proxyPort", "3128");
		Authenticator.setDefault(new ProxyAuthenticator("name", "password"));

		try {
			url = new URL("http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html");
			InputStream in = url.openStream();
			int i  = -1;
			while((i=in.read())>-1){
				System.out.print((char)i);
			}
			in.close();
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}


参考资料:http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html