@Test
  public void testWaitForDeparture() throws Exception {
    Properties config = new Properties();
    config.put(LOCATORS, "");
    config.put(START_LOCATOR, "localhost[" + locatorPort + "]");
    config.put(DISABLE_TCP, "true");

    InternalDistributedSystem system =
        (InternalDistributedSystem) DistributedSystem.connect(config);

    // construct a member ID that will represent a departed member
    InternalDistributedMember member =
        new InternalDistributedMember("localhost", 12345);

    // schedule a message in order to create a queue for the fake member
    ClusterDistributionManager distributionManager =
        (ClusterDistributionManager) system.getDistributionManager();
    final FakeMessage message = new FakeMessage(null);

    distributionManager.getExecutors().getExecutor(SERIAL_EXECUTOR, member)
        .execute(new SizeableRunnable(100) {

          @Override
          public void run() { // always throws NullPointerException
            message.doAction(distributionManager, false);
          }

          @Override
          public String toString() {
            return "Processing fake message";
          }
        });

    Assert.assertTrue("expected the serial queue to be flushed",
        distributionManager.getDistribution().waitForDeparture(member));
    Assert.assertTrue(message.processed);
  }
ensure that waitForMemberDeparture correctly flushes the serial message queue for the given
member
geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java