public void testEncodeString() {
    String userName = "******";
    String password = "******";

    String result = BASE64Encoder.encode((userName + ":" + password));

    assertEquals(
        "YSByZWFsbHkgc2VjcmV0ICEgTG9naW5AOmFuIF5ldmVuIG1vcmUmIHNlY3IzdCBwYXNzd2Q=", result);
  }
 @SuppressWarnings("restriction")
 public static String encode(byte[] raw) {
   BASE64Encoder encoder = new BASE64Encoder();
   return encoder.encode(raw);
 }