public void testAwait_whenInstanceShutdown_thenHazelcastInstanceNotActiveException() throws InterruptedException {
HazelcastInstance instance = createHazelcastInstance();
final ICountDownLatch latch = instance.getCountDownLatch(randomString());
latch.trySetCount(10);
final TestThread awaitThread = new TestThread() {
@Override
public void doRun() throws Exception {
latch.await(1, TimeUnit.HOURS);
}
};
awaitThread.start();
// give the awaitthread some time to get in the waiting state
sleepSeconds(5);
instance.shutdown();
awaitThread.assertFailsEventually(HazelcastInstanceNotActiveException.class);
}