kdcOptions.set( KdcOptions.RENEWABLE );
kdcReqBody.setKdcOptions( kdcOptions );
long now = System.currentTimeMillis();
KerberosTime requestedEndTime = new KerberosTime( now + 1 * KerberosTime.DAY );
kdcReqBody.setTill( requestedEndTime );
KerberosTime requestedRenewTillTime = new KerberosTime( now + 2 * KerberosTime.WEEK );
kdcReqBody.setRtime( requestedRenewTillTime );
KdcReq message = getKdcRequest( tgt, kdcReqBody );
handler.messageReceived( session, message );
Object msg = session.getMessage();
assertEquals( "session.getMessage() instanceOf", TgsRep.class, msg.getClass() );
TgsRep reply = ( TgsRep ) msg;
assertTrue( "RENEWABLE flag", reply.getFlags().isRenewable() );
assertFalse( "INVALID flag", reply.getFlags().isInvalid() );
assertTrue( "RENEWABLE flag", reply.getTicket().getEncTicketPart().getFlags().isRenewable() );
assertFalse( "INVALID flag", reply.getTicket().getEncTicketPart().getFlags().isInvalid() );
KerberosTime expectedRenewTillTime = new KerberosTime( now + KerberosTime.WEEK );
boolean isClose = Math.abs( reply.getRenewTill().getTime() - expectedRenewTillTime.getTime() ) < 5000;
assertTrue( "Expected renew-till time", isClose );
}