public static Credential basic(String userName,String password){
  try {
    String usernameAndPassword=userName + ":" + password;
    byte[] bytes=usernameAndPassword.getBytes("ISO-8859-1");
    String encoded=Base64.encode(bytes);
    return new Credential("Basic " + encoded);
  }
 catch (  UnsupportedEncodingException e) {
    throw new AssertionError();
  }
}

public static Credential basic ( String userName , String password ) { try { String usernameAndPassword = userName + ":" + password ; byte [ ] bytes = usernameAndPassword . getBytes ( "ISO-8859-1" ) ; String encoded = Base64 . encode ( bytes ) ; return new Credential ( "Basic " + encoded ) ; } catch ( UnsupportedEncodingException e ) { throw new AssertionError ( ) ; } }
returns an auth credential for the basic scheme .
