for (int i = 0; i < tryCount; i++) {
final HazelcastInstance instance = Hazelcast.newHazelcastInstance();
final HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
final ILock lock = client.getLock("lock");
assertTrue(lock.tryLock(1, TimeUnit.MINUTES));
client.getLifecycleService().terminate(); //with client is dead, lock should be released.
instance.getLifecycleService().terminate();
}
}