как то так
static void SetProxy(){
System.setProperty("java.net.preferIPv4Stack" , "true");
System.setProperty("proxySet", "true"); //Obsolete ?
System.setProperty("http.proxyHost", "proxy.adress.ru");
System.setProperty("http.proxyPort", "8080");
System.setProperty("https.proxyHost", "proxy.adress.ru");
System.setProperty("https.proxyPort", "8080");
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("domain\\username","password".toCharArray());
}
});
}
static void SetProxy(){
System.setProperty("java.net.preferIPv4Stack" , "true");
System.setProperty("proxySet", "true"); //Obsolete ?
System.setProperty("http.proxyHost", "proxy.adress.ru");
System.setProperty("http.proxyPort", "8080");
System.setProperty("https.proxyHost", "proxy.adress.ru");
System.setProperty("https.proxyPort", "8080");
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("domain\\username","password".toCharArray());
}
});
}
Комментариев нет:
Отправить комментарий