@Test
 public void clear() {
   HazelcastClient hClient = getHazelcastClient();
   IMap map = hClient.getMap("clear");
   for (int i = 0; i < 100; i++) {
     assertNull(map.put(i, i));
     assertEquals(i, map.get(i));
   }
   map.clear();
   for (int i = 0; i < 100; i++) {
     assertNull(map.get(i));
   }
 }
 @Test
 public void addListenerForKey() throws InterruptedException, IOException {
   HazelcastClient hClient = getHazelcastClient();
   final IMap<String, String> map = hClient.getMap("addListenerForKey");
   map.clear();
   assertEquals(0, map.size());
   final CountDownLatch entryAddLatch = new CountDownLatch(1);
   final CountDownLatch entryUpdatedLatch = new CountDownLatch(1);
   final CountDownLatch entryRemovedLatch = new CountDownLatch(1);
   CountDownLatchEntryListener<String, String> listener =
       new CountDownLatchEntryListener<String, String>(
           entryAddLatch, entryUpdatedLatch, entryRemovedLatch);
   map.addEntryListener(listener, "hello", true);
   assertNull(map.get("hello"));
   map.put("hello", "world");
   map.put("hello", "new world");
   assertEquals("new world", map.get("hello"));
   map.remove("hello");
   assertTrue(entryAddLatch.await(10, TimeUnit.SECONDS));
   assertTrue(entryUpdatedLatch.await(10, TimeUnit.SECONDS));
   assertTrue(entryRemovedLatch.await(10, TimeUnit.SECONDS));
 }
 @Test
 public void addListenerAndMultiPut() throws InterruptedException, IOException {
   HazelcastClient hClient = getHazelcastClient();
   final IMap<String, byte[]> map = hClient.getMap("addListenerAndMultiPut");
   map.clear();
   int counter = 100;
   assertEquals(0, map.size());
   final CountDownLatch entryAddLatch = new CountDownLatch(counter);
   final CountDownLatch entryUpdatedLatch = new CountDownLatch(counter);
   final CountDownLatch entryRemovedLatch = new CountDownLatch(counter);
   CountDownLatchEntryListener<String, byte[]> listener =
       new CountDownLatchEntryListener<String, byte[]>(
           entryAddLatch, entryUpdatedLatch, entryRemovedLatch);
   map.addEntryListener(listener, true);
   assertNull(map.get("hello"));
   Map<String, byte[]> many = new HashMap<String, byte[]>();
   for (int i = 0; i < counter; i++) {
     many.put("" + i, new byte[i]);
   }
   map.putAll(many);
   assertTrue(entryAddLatch.await(10, TimeUnit.SECONDS));
   //        assertTrue(entryUpdatedLatch.await(10, TimeUnit.MILLISECONDS));
   //        assertTrue(entryRemovedLatch.await(10, TimeUnit.MILLISECONDS));
 }