@Test
  public void testKickOutSickMember() {
    addIgnoredException("10 seconds have elapsed while waiting");
    addIgnoredException(MemberDisconnectedException.class);

    // in order to set a small ack-wait-threshold, we have to remove the
    // system property established by the dunit harness
    System.clearProperty(GEMFIRE_PREFIX + ACK_WAIT_THRESHOLD);

    Properties config = getDistributedSystemProperties();
    config.setProperty(MCAST_PORT, "0"); // loner
    config.setProperty(ACK_WAIT_THRESHOLD, "5");
    config.setProperty(ACK_SEVERE_ALERT_THRESHOLD, "5");
    config.setProperty(NAME, "putter");

    getCache(config);
    RegionFactory<String, String> regionFactory = getCache().createRegionFactory();
    regionFactory.setScope(Scope.DISTRIBUTED_ACK);
    regionFactory.setDataPolicy(DataPolicy.REPLICATE);
    Region<String, String> region = regionFactory.create("testRegion");

    addIgnoredException("sec have elapsed while waiting for replies");
    // Ignore logging from Connection.doSevereAlertProcessing()
    addIgnoredException("seconds have elapsed waiting for a response from");

    vm1.invoke(new SerializableRunnable("Connect to distributed system") {
      @Override
      public void run() {
        config.setProperty(NAME, "sleeper");
        getCache(config);

        addIgnoredException("service failure");
        addIgnoredException(ForcedDisconnectException.class.getName());
        RegionFactory<String, String> regionFactory2 = getCache().createRegionFactory();
        regionFactory2.setScope(Scope.DISTRIBUTED_ACK);
        regionFactory2.setDataPolicy(DataPolicy.REPLICATE);
        regionFactory2.addCacheListener(getSleepingListener(true));

        regionFactory2.create("testRegion");
        myCache = getCache();
      }
    });

    // now we have two caches set up, each having an alert listener. Vm1
    // also has a cache listener that will turn off its ability to respond
    // to "are you dead" messages and then sleep

    region.put("bomb", "pow!");
    disconnectFromDS();

    vm1.invoke("wait for forced disconnect", () -> {
      await("vm1's system should have been disconnected")
          .untilAsserted(() -> assertThat(basicGetSystem().isConnected()).isFalse());

      await("vm1's cache is not closed")
          .untilAsserted(() -> assertThat(myCache.isClosed()).isTrue());

      await("vm1's listener should have received afterRegionDestroyed notification")
          .untilAsserted(() -> assertThat(regionDestroyedInvoked).isTrue());
    });
  }
Tests that a sick member is kicked out
geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/ClusterDistributionManagerDUnitTest.java