I have a java app that has to connect thru a proxy to some addresses This is what I've tried
final String authUser = "xxx"; final String authPassword = "xxx"; Authenticator.setDefault( new Authenticator(){ public PasswordAuthentication getPasswordauthentication(){ return new PasswordAuthentication( authUser, authPassword.toCharArray()); } }); System.setProperty("http.proxyUser", authUser); System.setProperty("http.proxyPassword",authPassword); System.setProperty("http.proxyHost","xxx"); System.setProperty("http.proxyPort","8080");
After I run the program it gives me this error:
java.net.ConnectException: Connection refused: connect
I have a java app that has to connect thru a proxy to some addresses This is what I've tried
final String authUser = "xxx";
final String authPassword = "xxx";
Authenticator.setDefault(
new Authenticator(){
public PasswordAuthentication getPasswordauthentication(){
return new PasswordAuthentication(
authUser, authPassword.toCharArray());
}
});
System.setProperty("http.proxyUser", authUser);
System.setProperty("http.proxyPassword",authPasswo rd);
System.setProperty("http.proxyHost","xxx");
System.setProperty("http.proxyPort","8080");
After I run the program it gives me this error:
java.net.ConnectException: Connection refused: connect
Is it correct how I tried to connect through the proxy and authenticate?
Any Help is appreciated!