@Test
  public void test2FailOverDistributedServer() throws Exception {
    // set notifyBySubscription=true to test register interest
    int serverPort1 = server1.invoke(() -> new ServerBuilder()
        .regionShortcut(REPLICATE)
        .create());
    int serverPort2 = server2.invoke(() -> new ServerBuilder()
        .regionShortcut(REPLICATE)
        .create());

    client1.invoke(() -> new ClientBuilder()
        .registerInterest(true)
        .serverPorts(serverPort1, serverPort2)
        .subscriptionAckInterval()
        .subscriptionEnabled(true)
        .subscriptionRedundancy()
        .create());
    client2.invoke(() -> new ClientBuilder()
        .registerInterest(true)
        .serverPorts(serverPort1, serverPort2)
        .subscriptionAckInterval()
        .subscriptionEnabled(true)
        .subscriptionRedundancy()
        .create());

    // server1 add slow listener
    server1.invoke(() -> {
      Region<String, TickerData> region = getCache().getRegion(regionName);
      region.getAttributesMutator().addCacheListener(new SlowCacheListener<>());
    });

    // server2 add slow listener
    server2.invoke(() -> {
      Region<String, TickerData> region = getCache().getRegion(regionName);
      region.getAttributesMutator().addCacheListener(new SlowCacheListener<>());
    });

    // client1 registerInterest
    client1.invoke(() -> {
      Region<String, TickerData> region = getClientCache().getRegion(regionName);
      region.registerInterest("ALL_KEYS");
    });

    // client2 registerInterest
    client2.invoke(() -> {
      Region<String, TickerData> region = getClientCache().getRegion(regionName);
      region.registerInterest("ALL_KEYS");
    });

    // async putAll1 from client1
    AsyncInvocation<Void> putAllInClient1 = client1.invokeAsync(() -> {
      try {
        doPutAll(getClientCache().getRegion(regionName), "async1key-", ONE_HUNDRED);
      } catch (ServerConnectivityException ignore) {
        // stopping the cache server will cause ServerConnectivityException
        // in the client if it hasn't completed performing the 100 puts yet
      }
    });

    // stop cache server 1
    server1.invoke(() -> {
      Region<String, TickerData> region = getCache().getRegion(regionName);
      await().untilAsserted(() -> assertThat(region.get("async1key-1")).isNotNull());
      stopCacheServer(serverPort1);
    });

    putAllInClient1.await();

    // verify cache server 2 for async keys
    server2.invoke(() -> {
      Region<String, TickerData> region = getCache().getRegion(regionName);

      long timeStamp = 0;
      for (int i = 0; i < ONE_HUNDRED; i++) {
        TickerData tickerData = region.getEntry("async1key-" + i).getValue();
        assertThat(tickerData.getPrice()).isEqualTo(i);
        assertThat(tickerData.getTimeStamp()).isGreaterThanOrEqualTo(timeStamp);
        timeStamp = tickerData.getTimeStamp();
      }
    });
  }
Tests while putAll to 2 distributed servers, one server failed over Add a listener to slow down
the processing of putAll
geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/PutAllClientServerDistributedTest.java