@Test
  public void testLoadMessaging() throws Exception {
    final Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    VM vm1 = host.getVM(1);
    VM vm2 = host.getVM(2);

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

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

    // We expect 0 load
    Map expected = new HashMap();
    ServerLocation expectedLocation = new ServerLocation(hostName, serverPort);
    ServerLoad expectedLoad = new ServerLoad(0f, 1 / 800.0f, 0f, 1f);
    expected.put(expectedLocation, expectedLoad);
    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
    vm2.invoke("StartBridgeClient", () -> {
      PoolFactoryImpl pf = new PoolFactoryImpl(null);
      pf.addServer(NetworkUtils.getServerHostName(host), serverPort);
      pf.setMinConnections(8);
      pf.setMaxConnections(8);
      pf.setSubscriptionEnabled(true);
      startBridgeClient(pf.getPoolAttributes(), new String[] {REGION_NAME});
      return null;
    });

    // We expect 8 client to server connections. The queue requires
    // an additional client to server connection, but that shouldn't show up here.
    expectedLoad = new ServerLoad(8 / 800f, 1 / 800.0f, 1f, 1f);
    expected.put(expectedLocation, expectedLoad);

    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));

    stopBridgeMemberVM(vm2);

    // Now we expect 0 load
    expectedLoad = new ServerLoad(0f, 1 / 800.0f, 0f, 1f);
    expected.put(expectedLocation, expectedLoad);
    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
  }
Test to make sure the cache servers communicate their updated load to the controller when the
load on the cache server changes.
geode-core/src/distributedTest/java/org/apache/geode/cache/client/internal/LocatorLoadBalancingDUnitTest.java