@Test
  public void shutdownMessageCausesTargetMemberToLeaveStateFlushReplyProcessor() {
    vm1.invoke("join the cluster", () -> getSystem().getDistributedMember()); // lead member
    system = getSystem(); // non-lead member
    DistributedMember targetId = locatorvm.invoke(() -> {
      return Locator.getLocator().getDistributedSystem().getDistributedMember();
    });

    StateFlushOperation.StateFlushReplyProcessor stateFlushReplyProcessor =
        new StateFlushOperation.StateFlushReplyProcessor(getSystem().getDistributionManager(),
            new HashSet(), targetId);
    system.getDistributionManager().addMembershipListener(stateFlushReplyProcessor);
    final InternalDistributedMember memberID = system.getDistributedMember();

    locatorvm.invoke("send a shutdown message", () -> {
      final DistributionManager distributionManager =
          ((InternalDistributedSystem) Locator.getLocator().getDistributedSystem())
              .getDistributionManager();
      final ShutdownMessage shutdownMessage = new ShutdownMessage();
      shutdownMessage.setRecipient(memberID);
      shutdownMessage.setDistributionManagerId(distributionManager.getDistributionManagerId());
      distributionManager.putOutgoing(shutdownMessage);
    });

    await().untilAsserted(
        () -> assertThat(stateFlushReplyProcessor.getTargetMemberHasLeft()).isTrue());
  }
Test the handling of "surprise members" in the membership manager. Create a DistributedSystem
in this VM and then add a fake member to its surpriseMember set. Then ensure that it stays in
the set when a new membership view arrives that doesn't contain it. Then wait until the member
should be gone and force more view processing to have it scrubbed from the set.
geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/ClusterDistributionManagerDUnitTest.java