@Test
public void testCancelCalendarWhileTimeoutActive() throws NamingException, InterruptedException {
InitialContext ctx = new InitialContext();
CalendarTimerServiceBean bean = (CalendarTimerServiceBean)ctx.lookup("java:module/" + CalendarTimerServiceBean.class.getSimpleName());
TimerHandle handle = bean.createTimer();
Assert.assertTrue(bean.getTimerEntry().await(TIMER_CALL_WAITING_S, TimeUnit.SECONDS));
//now the timeout is in progress cancel the timer
handle.getTimer().cancel();
bean.getTimerExit().countDown();
Assert.assertFalse(CalendarTimerServiceBean.quickAwaitTimerCall());
Assert.assertEquals(0, bean.getTimerCount());
}