@Test
  public void testConnectedClients() {
    final HazelcastInstance instance = Hazelcast.newHazelcastInstance();

    final HazelcastInstance client1 = HazelcastClient.newHazelcastClient();
    final HazelcastInstance client2 = HazelcastClient.newHazelcastClient();

    final ClientService clientService = instance.getClientService();
    final Collection<Client> connectedClients = clientService.getConnectedClients();
    assertEquals(2, connectedClients.size());

    final String uuid1 = client1.getLocalEndpoint().getUuid();
    final String uuid2 = client2.getLocalEndpoint().getUuid();
    for (Client connectedClient : connectedClients) {
      final String uuid = connectedClient.getUuid();
      assertTrue(uuid.equals(uuid1) || uuid.equals(uuid2));
    }
  }
 @Override
 public void handle(String name, Data key, String sourceUuid) {
   if (client.getUuid().equals(sourceUuid)) {
     return;
   }
   if (key != null) {
     nearCache.remove(key);
   } else {
     nearCache.clear();
   }
 }
 @Override
 public void handle(String name, Collection<Data> keys, Collection<String> sourceUuids) {
   if (sourceUuids != null && !sourceUuids.isEmpty()) {
     Iterator<Data> keysIt = keys.iterator();
     Iterator<String> sourceUuidsIt = sourceUuids.iterator();
     while (keysIt.hasNext() && sourceUuidsIt.hasNext()) {
       Data key = keysIt.next();
       String sourceUuid = sourceUuidsIt.next();
       if (!client.getUuid().equals(sourceUuid)) {
         nearCache.remove(key);
       }
     }
   } else {
     for (Data key : keys) {
       nearCache.remove(key);
     }
   }
 }