A DESCRIPTION OF THE REQUEST :
Now, we use the code below to use proxy in URLConnection. But the Authenticator is JVM global, not bind to a specific URLConnection. But actually we need to access different proxy(with different Authenticator) in applications.
Authenticator.setDefault(
new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
authUser, authPassword.toCharArray());
}
}
);
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.1", 8080));
conn = new URL(urlString).openConnection(proxy);
JUSTIFICATION :
the concept of model of proxy Authenticator is built not correctly.