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

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

    final ServerLoad load1 = new ServerLoad(.3f, .01f, .44f, 4564f);
    final ServerLoad load2 = new ServerLoad(23.2f, 1.1f, 22.3f, .3f);
    int serverPort1 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators,
        new String[] {REGION_NAME}, new MyLoadProbe(load1), false));
    int serverPort2 = vm2.invoke("Start BridgeServer", () -> startBridgeServer(null, locators,
        new String[] {REGION_NAME}, new MyLoadProbe(load2), false));

    HashMap expected = new HashMap();
    ServerLocation l1 = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort1);
    ServerLocation l2 = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort2);
    expected.put(l1, load1);
    expected.put(l2, load2);
    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));

    load1.setConnectionLoad(25f);
    vm1.invoke("changeLoad", () -> changeLoad(load1));
    load2.setSubscriptionConnectionLoad(3.5f);
    vm2.invoke("changeLoad", () -> changeLoad(load2));
    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));

    final ServerLoad load1Updated = new ServerLoad(1f, .1f, 0f, 1f);
    final ServerLoad load2Updated = new ServerLoad(2f, 5f, 0f, 2f);
    expected.put(l1, load1Updated);
    expected.put(l2, load2Updated);
    vm1.invoke("changeLoad", () -> changeLoad(load1Updated));
    vm2.invoke("changeLoad", () -> changeLoad(load2Updated));
    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));

    PoolFactoryImpl pf = new PoolFactoryImpl(null);
    pf.addLocator(NetworkUtils.getServerHostName(host), locatorPort);
    pf.setMinConnections(20);
    pf.setSubscriptionEnabled(true);
    pf.setIdleTimeout(-1);
    startBridgeClient(pf.getPoolAttributes(), new String[] {REGION_NAME});
    waitForPrefilledConnections(20);

    // The first 10 connection should to go vm1, then 1 to vm2, then another 9 to vm1
    // because have unequal values for loadPerConnection
    vm1.invoke("Check Connection Count", () -> checkConnectionCount(19));
    vm2.invoke("Check Connection Count", () -> checkConnectionCount(1));
  }
Test that the locator balances load between three servers with intersecting server groups.
Server: 1 2 3 Groups: a a,b b
geode-core/src/distributedTest/java/org/apache/geode/cache/client/internal/LocatorLoadBalancingDUnitTest.java