Code example for PasswordAuthentication

0
    final String password = pass;
    Authenticator.setDefault(new Authenticator()
    { 
      protected PasswordAuthentication getPasswordAuthentication()
      { 
        return new PasswordAuthentication(username,
          password.toCharArray());
      }  
    }); 
  } 
   
  //always dontVerify the host - dont check for certificate 
  final HostnameVerifier DO_NOT_VERIFY=new HostnameVerifier()
  { 
    public boolean verify(String hostname, SSLSession session) 
    { 
      return true; 
    } 
  }; 
 
  /**