// generate context
byte[] contextToken = new byte[0];
try {
byte[] target = csmList.mechanism_list[0].as_context_mech.target_name;
Oid krb5Oid = new Oid(KRB5MechOID.value.substring(4));
GSSManager gssManager = GSSManager.getInstance();
GSSName myPeer = gssManager.createName(target, null, krb5Oid);
if (clientCreds == null) clientCreds = gssManager.createCredential(null, GSSCredential.INDEFINITE_LIFETIME, krb5Oid, GSSCredential.INITIATE_ONLY);
GSSContext myContext = gssManager.createContext(myPeer, krb5Oid, clientCreds, GSSContext.INDEFINITE_LIFETIME);
contextToken = myContext.initSecContext(contextToken, 0, contextToken.length);