}
}
public void testCreateName() throws Exception {
GSSName gssName = gssManager.createName("username",
GSSName.NT_USER_NAME);
assertEquals(GSSName.NT_USER_NAME, gssName.getStringNameType());
gssName = gssManager.createName("service@host",
GSSName.NT_HOSTBASED_SERVICE);
assertEquals(GSSName.NT_HOSTBASED_SERVICE, gssName.getStringNameType());
final Oid kerberosPrincipalOid = new Oid("1.2.840.113554.1.2.2.1");
gssName = gssManager.createName("kerberosPrincipal",
kerberosPrincipalOid);
assertEquals(kerberosPrincipalOid, gssName.getStringNameType());
byte[] encoded = new byte[] { 4, 1, 0, 11, 6, 9, 42, -122, 72, -122,
-9, 18, 1, 2, 2, 0, 0, 0, 17, 115, 101, 114, 118, 105, 99, 101,
47, 108, 111, 99, 97, 108, 104, 111, 115, 116 };
gssName = gssManager.createName(encoded, GSSName.NT_EXPORT_NAME);
assertEquals(kerberosPrincipalOid, gssName.getStringNameType());
GSSName expectedGSSName = gssManager.createName("service/localhost", kerberosPrincipalOid);
assertEquals(expectedGSSName, gssName);
}