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();
		}

ProxyAuthenticator.java


import java.net.Authenticator;
import java.net.PasswordAuthentication;

public class ProxyAuthenticator extends Authenticator {
    private String userName, password; 
    protected PasswordAuthentication getPasswordAuthentication() { 
        return new PasswordAuthentication(userName, password.toCharArray()); 
    } 
    public ProxyAuthenticator(String userName, String password) { 
        this.userName = userName; 
        this.password = password; 
    } 
}

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