@Test
  public void testGetReplacementServerForConnection() {
    final LocatorLoadSnapshot loadSnapshot = new LocatorLoadSnapshot();

    final ServerLocation l1 = new ServerLocation("localhost", 1);
    final ServerLocation l2 = new ServerLocation("localhost", 2);
    final ServerLocation l3 = new ServerLocation("localhost", 3);
    final String uniqueId1 = new InternalDistributedMember("localhost", 1).getUniqueId();
    final String uniqueId2 = new InternalDistributedMember("localhost", 2).getUniqueId();
    final String uniqueId3 = new InternalDistributedMember("localhost", 3).getUniqueId();

    float l1ConnectionLoad = 50;
    float l2ConnectionLoad = 40;
    float l3ConnectionLoad = 30;

    loadSnapshot.addServer(l1, uniqueId1, new String[] {"a"},
        new ServerLoad(l1ConnectionLoad, 1, 0, 1),
        LOAD_POLL_INTERVAL);
    loadSnapshot.addServer(l2, uniqueId2, new String[] {"a", "b"},
        new ServerLoad(l2ConnectionLoad, 1, 0, 1), LOAD_POLL_INTERVAL);
    loadSnapshot.addServer(l3, uniqueId3, new String[] {"b"},
        new ServerLoad(l3ConnectionLoad, 1, 0, 1),
        LOAD_POLL_INTERVAL);

    ServerLocation newServer1 =
        loadSnapshot.getReplacementServerForConnection(l1, "", Collections.emptySet());
    assertThat(newServer1).isEqualTo(l3);
    ServerLocation newServer2 =
        loadSnapshot.getReplacementServerForConnection(l1, "a", Collections.emptySet());
    assertThat(newServer2).isEqualTo(l2);
    ServerLocation newServer3 =
        loadSnapshot.getReplacementServerForConnection(l3, "b", Collections.emptySet());
    assertThat(newServer3).isEqualTo(l3);
    ServerLocation newServer4 =
        loadSnapshot.getReplacementServerForConnection(l2, "b", Collections.emptySet());
    assertThat(newServer4).isEqualTo(l3);
  }
Test that we can specify a list of servers to exclude and the snapshot honors the request when
picking the best server.
geode-core/src/test/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotTest.java