KerberosPrincipal serverPrincipal = new KerberosPrincipal( "krbtgt/EXAMPLE.COM@EXAMPLE.COM" );
String passPhrase = "randomKey";
EncryptionKey serverKey = getEncryptionKey( serverPrincipal, passPhrase );
Ticket tgt = getTicket( encTicketPart, serverPrincipal, serverKey );
KdcReqBody kdcReqBody = new KdcReqBody();
kdcReqBody.setSName( getPrincipalName( "ldap/ldap.example.com@EXAMPLE.COM" ) );
kdcReqBody.setRealm( "EXAMPLE.COM" );
Set<EncryptionType> encryptionTypes = new HashSet<EncryptionType>();
encryptionTypes.add( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
kdcReqBody.setEType( encryptionTypes );
kdcReqBody.setNonce( random.nextInt() );
KdcOptions kdcOptions = new KdcOptions();
kdcReqBody.setKdcOptions( kdcOptions );
long now = System.currentTimeMillis();
KerberosTime requestedEndTime = new KerberosTime( now + 1 * KerberosTime.DAY );
kdcReqBody.setTill( requestedEndTime );
KdcReq message = getKdcRequest( tgt, kdcReqBody );
handler.messageReceived( session, message );