kdcOptions.set( KdcOptions.RENEWABLE_OK );
modifier.setKdcOptions( kdcOptions );
long now = System.currentTimeMillis();
KerberosTime requestedEndTime = new KerberosTime( now + KerberosTime.WEEK );
modifier.setTill( requestedEndTime );
RequestBody requestBody = modifier.getRequestBody();
KdcRequest message = getKdcRequest( tgt, requestBody );
handler.messageReceived( session, message );
TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();
KerberosTime expectedEndTime = new KerberosTime( now + KerberosTime.DAY );
boolean isClose = Math.abs( reply.getEndTime().getTime() - expectedEndTime.getTime() ) < 5000;
assertTrue( "Expected end time", isClose );
assertTrue( "RENEWABLE flag", reply.getFlags().isRenewable() );
assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
KerberosTime expectedRenewTillTime = new KerberosTime( now + KerberosTime.WEEK );
isClose = Math.abs( reply.getRenewTill().getTime() - expectedRenewTillTime.getTime() ) < 5000;
assertTrue( "Expected renew-till time", isClose );
}