private Authenticator buildAuthenticator(final String username, final String password) {
if (null != password && null != username) {
return new Authenticator() {
private final PasswordAuthentication passwordAuthentication =
new PasswordAuthentication(username, password);
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return passwordAuthentication;
}