@Test
  public void testSimpleDurableClient() {

    // Step 1: Starting the servers
    PORT1 = server1VM.invoke(() -> createCacheServer(regionName, Boolean.TRUE));
    PORT2 = server2VM.invoke(() -> createCacheServer(regionName, Boolean.TRUE));

    // Step 2: Bring Up the Client
    // Start a durable client that is not kept alive on the server when it stops normally
    final String durableClientId = getName() + "_client";

    final int durableClientTimeout = 600; // keep the client alive for 600
    // seconds
    durableClientVM.invoke(() -> createCacheClient(
        getClientPool(hostName, PORT1, PORT2, true,
            0),
        regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout),
        Boolean.TRUE));



    // Step 3: Client registers Interests
    // KEY_STONE1, KEY_STONE2 are registered as durableKeys & KEY_STONE3,
    // KEY_STONE4 as non-durableKeys
    durableClientVM.invoke(() -> registerKey(K1, Boolean.FALSE));
    durableClientVM.invoke(() -> registerKey(K2, Boolean.FALSE));
    durableClientVM.invoke(() -> registerKey(K3, Boolean.TRUE));
    durableClientVM.invoke(() -> registerKey(K4, Boolean.TRUE));


    // Send clientReady message
    durableClientVM.invoke("Send clientReady", new CacheSerializableRunnable() {
      @Override
      public void run2() throws CacheException {
        getClientCache().readyForEvents();
      }
    });

    // Step 4: Update Values on the Server for KEY_STONE1, KEY_STONE2,
    // KEY_STONE3, KEY_STONE4
    server2VM.invoke(() -> putValue(K1, "Value1"));
    server2VM.invoke(() -> putValue(K2, "Value2"));
    server2VM.invoke(() -> putValue(K3, "Value3"));
    server2VM.invoke(() -> putValue(K4, "Value4"));


    GeodeAwaitility.await().atMost(1000, TimeUnit.MILLISECONDS)
        .until(() -> server2VM.invoke(() -> getValue(K1).contentEquals("Value1")));
    // Step 5: Verify Updates on the Client
    assertThat(server2VM.invoke(() -> getValue(K1))).isEqualTo("Value1");
    assertThat(server1VM.invoke(() -> getValue(K1))).isEqualTo("Value1");

    assertThat(durableClientVM.invoke(() -> getValue(K1))).isEqualTo("Value1");
    assertThat(durableClientVM.invoke(() -> getValue(K2))).isEqualTo("Value2");
    assertThat(durableClientVM.invoke(() -> getValue(K3))).isEqualTo("Value3");
    assertThat(durableClientVM.invoke(() -> getValue(K4))).isEqualTo("Value4");

    // Step 6: Close Cache of the DurableClient
    durableClientVM.invoke(this::closeCache);

    // Step 7: Update KEY_STONE1,KEY_STONE2,KEY_STONE3,KEY_STONE4 on the
    // Server say with values PingPong1, PingPong2, PingPong3, PingPong4
    server2VM.invoke(() -> putValue(K1, "PingPong1"));
    server2VM.invoke(() -> putValue(K2, "PingPong2"));
    server2VM.invoke(() -> putValue(K3, "PingPong3"));
    server2VM.invoke(() -> putValue(K4, "PingPong4"));

    // Step 8: Re-start the Client
    durableClientVM.invoke(() -> createCacheClient(
        getClientPool(hostName, PORT1, PORT2,
            true, 0),
        regionName, getClientDistributedSystemProperties(durableClientId), Boolean.TRUE));

    // Send clientReady message
    durableClientVM.invoke("Send clientReady", new CacheSerializableRunnable() {
      @Override
      public void run2() throws CacheException {
        getClientCache().readyForEvents();
      }
    });

    GeodeAwaitility.await().atMost(5000, TimeUnit.MILLISECONDS)
        .until(() -> durableClientVM.invoke(() -> getValue(K1) == null));

    assertThat(durableClientVM.invoke(() -> getValue(K2))).isNull();

    durableClientVM.invoke(() -> registerKey(K1, Boolean.FALSE));

    GeodeAwaitility.await().atMost(5000, TimeUnit.MILLISECONDS)
        .until(() -> durableClientVM.invoke(() -> getValue(K1) == null));
    assertThat(durableClientVM.invoke(() -> getValue(K2))).isNull();

    server2VM.invoke(() -> putValue(K1, "PingPong_updated_1"));
    server2VM.invoke(() -> putValue(K2, "PingPong_updated_2"));
    server2VM.invoke(() -> putValue(K3, "PingPong_updated_3"));
    server2VM.invoke(() -> putValue(K4, "PingPong_updated_4"));


    // Step 9: Verify Updates on the Client
    GeodeAwaitility.await().atMost(5000, TimeUnit.MILLISECONDS).until(
        () -> durableClientVM.invoke(() -> getValue(K1).contentEquals("PingPong_updated_1")));

    assertThat(durableClientVM.invoke(() -> getValue(K2))).isNull();
    assertThat(durableClientVM.invoke(() -> getValue(K3))).isEqualTo("PingPong_updated_3");
    assertThat(durableClientVM.invoke(() -> getValue(K4))).isEqualTo("PingPong_updated_4");

    // Step 10 : Stop all VMs
    // Stop the durable client
    durableClientVM.invoke(() -> CacheServerTestUtil.closeCache());

    // Stop server 2
    server2VM.invoke(() -> CacheServerTestUtil.closeCache());

    // Stop server 1
    server1VM.invoke(() -> CacheServerTestUtil.closeCache());

  }
We have 2 servers and One client which registers some keys with durable interest and some without
it. We maintain queues on only One server as redundancy level is one. Following 2 tests have the
two TestCase scenarios

There are two Tests First Test does the follows : // Step 1: Starting the servers // Step 2:
Bring Up the Client // Step 3: Client registers Interests // Step 4: Update Values on the Server
for Keys // Step 5: Verify Updates on the Client // Step 6: Close Cache of the DurableClient //
Step 7: Update the Values // Step 8: Re-start the Client // Step 9: Verify Updates on the Client
// Step 10 : Stop all VMs

For Test 2 the steps are as follows // Step 1: Starting the servers // Step 2: Bring Up the
Client // Step 3: Client registers Interests // Step 4: Update Values on the Server for Keys //
Step 5: Verify Updates on the Client // Step 6: Close Cache of the DurableClient // Step 7:
Update the Values // Step 8: Re-start the Client // Step 9: Send Client Ready Message // Step 10:
Register all Keys (K1, K2 as Non-Durable. K3, K4 as Durable) // Step 11: Unregister Some Keys
(Here K1, K3) // Step 12: Modify values on the server for all the Keys // Step 13: Check the
values for the ones not unregistered and the Unregistered Keys' Values should be null
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableRegistrationDistributedTest.java