@Test
  public void testReadyForEventsNotCalledImplicitly() {
    // Start a server
    server1Port = server1VM
        .invoke(() -> createCacheServer(regionName, true));

    // Start a durable client that is not kept alive on the server when it
    // stops normally
    final String durableClientId = getName() + "_client";
    // make the client use ClientCacheFactory so it will have a default pool
    durableClientVM.invoke(() -> createClientCache(
        getClientPool(getServerHostName(), server1Port, true), regionName,
        getClientDistributedSystemProperties(durableClientId)));

    // verify that readyForEvents has not yet been called on the client's default pool
    durableClientVM.invoke("check readyForEvents not called", new CacheSerializableRunnable() {
      @Override
      public void run2() throws CacheException {
        for (Pool p : PoolManager.getAll().values()) {
          assertThat(((PoolImpl) p).getReadyForEventsCalled()).isFalse();
        }
      }
    });

    // Send clientReady message
    sendClientReady(durableClientVM);

    // Verify durable clients on server
    server1VM.invoke("Verify durable client", new CacheSerializableRunnable() {
      @Override
      public void run2() throws CacheException {
        // Get the CacheClientNotifier
        CacheClientNotifier notifier = getBridgeServer().getAcceptor().getCacheClientNotifier();

        // Iterate the CacheClientProxies and verify they are correct
        checkNumberOfClientProxies(1);
        boolean durableClient1Found = false;
        for (CacheClientProxy proxy : notifier.getClientProxies()) {
          assertThat(proxy.isDurable()).isTrue();
          if (proxy.getDurableId().equals(durableClientId)) {
            durableClient1Found = true;
          }
          assertThat(DistributionConfig.DEFAULT_DURABLE_CLIENT_TIMEOUT)
              .isEqualTo(proxy.getDurableTimeout());
        }
        assertThat(durableClient1Found).isTrue();
      }
    });

    // Stop the durable clients
    durableClientVM.invoke((SerializableRunnableIF) CacheServerTestUtil::closeCache);

    // Stop the server
    server1VM.invoke((SerializableRunnableIF) CacheServerTestUtil::closeCache);
  }
Tests whether a durable client reconnects properly to two servers.
geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableClientSimpleDUnitTest.java