@Test
  public void testEstimation() throws IOException, ClassNotFoundException {
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    VM vm1 = host.getVM(1);

    String hostName = NetworkUtils.getServerHostName();
    int locatorPort = vm0.invoke("Start Locator", () -> startLocator(hostName, ""));
    String locators = getLocatorString(hostName, locatorPort);

    int serverPort = vm1.invoke("Start BridgeServer",
        () -> startBridgeServer(new String[] {"a", "b"}, locators));

    ServerLoad expectedLoad = new ServerLoad(2 / 800f, 1 / 800.0f, 0f, 1f);
    ServerLocation expectedLocation = new ServerLocation(hostName, serverPort);
    Map expected = new HashMap();
    expected.put(expectedLocation, expectedLoad);

    SocketCreatorFactory.setDistributionConfig(new DistributionConfigImpl(new Properties()));
    ClientConnectionResponse response;
    response = issueClientConnectionRequest(hostName, locatorPort,
        new ClientConnectionRequest(Collections.EMPTY_SET, null), true);
    Assert.assertEquals(expectedLocation, response.getServer());

    response = issueClientConnectionRequest(hostName, locatorPort,
        new ClientConnectionRequest(Collections.EMPTY_SET, null), true);
    Assert.assertEquals(expectedLocation, response.getServer());

    // we expect that the connection load load will be 2 * the loadPerConnection
    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));

    QueueConnectionResponse response2;
    response2 = issueQueueConnectionRequest(hostName, locatorPort, 2);
    Assert.assertEquals(Collections.singletonList(expectedLocation), response2.getServers());

    response2 = issueQueueConnectionRequest(hostName, locatorPort, 5);
    Assert.assertEquals(Collections.singletonList(expectedLocation), response2.getServers());

    // we expect that the queue load will increase by 2
    expectedLoad.setSubscriptionConnectionLoad(2f);
    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
  }
Test that the locator will properly estimate the load for servers when it receives connection
requests.
geode-core/src/distributedTest/java/org/apache/geode/cache/client/internal/LocatorLoadBalancingDUnitTest.java