private void checkConnectionCount(final int count) {
    Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
    final CacheServerImpl server = (CacheServerImpl) cache.getCacheServers().get(0);
    await().timeout(300, TimeUnit.SECONDS).until(() -> {
      int sz = server.getAcceptor().getStats().getCurrentClientConnections();
      if (Math.abs(sz - count) <= ALLOWABLE_ERROR_IN_COUNT) {
        return true;
      }
      System.out.println("Found " + sz + " connections, expected " + count);
      return false;
    });
  }
Test to make sure that the locator balancing load between two servers.
geode-core/src/distributedTest/java/org/apache/geode/cache/client/internal/LocatorLoadBalancingDUnitTest.java