The above post doesn't work through SSL because the headers get encrypted. However after upgrading the webservice stack(included in the above post), the Authenticator function works.
So, add an authenticator
import java.net.PasswordAuthentication;
public class ProxyAuthenticator extends java.net.Authenticator{
private String user, password;
public ProxyAuthenticator(String user, String password) {
this.user = user;
this.password = password;
}
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, password.toCharArray());
}
}
Then set the user name and password in your app, it will be applied to your JRE session
Authenticator.setDefault(new ProxyAuthenticator("user", "pass" ));
and it now works through SSL