Code example for PasswordAuthentication

0
			this.authenticator = new Authenticator() {
 
				@Override 
				protected PasswordAuthentication getPasswordAuthentication() {
					if (this.getRequestorType().equals(RequestorType.PROXY))
						return new PasswordAuthentication(user, password.toCharArray());
					else 
						return null; 
				} 
 
			}; 
		} 
		return authenticator;
	} 
 
	public Proxy getProxy() {
		if(proxy==null){
			proxy = new Proxy(Type.HTTP, InetSocketAddress.createUnresolved(host, port));
		} 
		return proxy;
	}