@Test
  public void testDurableClientExit_ClientExpressedInterest() throws Exception {
    final Host host = Host.getHost(0);
    VM serverVM = host.getVM(0);
    VM clientVM_1 = host.getVM(1);
    VM clientVM_2 = host.getVM(2);
    VM clientVM_3 = host.getVM(3);

    serverVM.invoke(InterestRegrListenerDUnitTest::setUpServerVMTask);
    serverVM.invoke(InterestRegrListenerDUnitTest::createServerTask);

    Object[] array = serverVM
        .invoke(InterestRegrListenerDUnitTest::getCacheServerEndPointTask);
    String hostName = (String) array[0];
    int port = (Integer) array[1];
    Object[] params = new Object[4];
    params[0] = hostName;
    params[1] = port;
    params[2] = true;
    params[3] = "VM_1";
    LogWriterUtils.getLogWriter()
        .info("Starting client1 with server endpoint <" + hostName + ">:" + port);
    clientVM_1.invoke(InterestRegrListenerDUnitTest.class, "setUpClientVMTask", params);

    params[3] = "VM_2";
    LogWriterUtils.getLogWriter()
        .info("Starting client2 with server endpoint <" + hostName + ">:" + port);
    clientVM_2.invoke(InterestRegrListenerDUnitTest.class, "setUpClientVMTask", params);

    params[3] = "VM_3";
    LogWriterUtils.getLogWriter()
        .info("Starting client2 with server endpoint <" + hostName + ">:" + port);
    clientVM_3.invoke(InterestRegrListenerDUnitTest.class, "setUpClientVMTask", params);


    params = new Object[1];
    params[0] = true;
    serverVM.invoke(InterestRegrListenerDUnitTest::doRegisterListenerTask);

    clientVM_1.invoke(InterestRegrListenerDUnitTest.class, "doClientRegionRegisterInterestTask",
        params);
    clientVM_2.invoke(InterestRegrListenerDUnitTest.class, "doClientRegionRegisterInterestTask",
        params);
    clientVM_3.invoke(InterestRegrListenerDUnitTest.class, "doClientRegionRegisterInterestTask",
        params);

    clientVM_1.invoke(InterestRegrListenerDUnitTest::doClientRegionPutTask);
    clientVM_2.invoke(InterestRegrListenerDUnitTest::doClientRegionPutTask);
    clientVM_3.invoke(InterestRegrListenerDUnitTest::doClientRegionPutTask);
    serverVM.invoke(InterestRegrListenerDUnitTest::doServerRegionPutTask);

    clientVM_1.invoke(() -> InterestRegrListenerDUnitTest.closeClientCacheTask(true));
    clientVM_2.invoke(() -> InterestRegrListenerDUnitTest.closeClientCacheTask(true));
    clientVM_3.invoke(() -> InterestRegrListenerDUnitTest.closeClientCacheTask(true));
    Thread.sleep(2);
    Map<String, Integer> listnerMap = serverVM
        .invoke(InterestRegrListenerDUnitTest::getListenerMapTask);
    LogWriterUtils.getLogWriter().info("Listener Map " + listnerMap);
    int registerCount = getMapValueForKey(listnerMap, REGISTER_INTEREST);
    int unregisterCount = getMapValueForKey(listnerMap, UNREGISTER_INTEREST);
    assertEquals(3, registerCount);
    assertEquals(0, unregisterCount);
    LogWriterUtils.getLogWriter().info(
        "Sleeping till durable client queue are expired and unregister event is called on to listener");
    Thread.sleep((DURABLE_CLIENT_TIMEOUT_TEST + 5) * 1000);
    listnerMap = serverVM
        .invoke(InterestRegrListenerDUnitTest::getListenerMapTask);
    LogWriterUtils.getLogWriter().info("Listener Map after sleeping " + listnerMap);
    registerCount = getMapValueForKey(listnerMap, REGISTER_INTEREST);
    unregisterCount = getMapValueForKey(listnerMap, UNREGISTER_INTEREST);
    assertEquals(3, registerCount);
    assertEquals(3, unregisterCount);
    serverVM.invoke(InterestRegrListenerDUnitTest::closeCacheTask);
  }
Written to test fix for Bug #47132
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/InterestRegrListenerDUnitTest.java