@Test
  public void shutdownMessageCausesListenerInvocation() {
    final AtomicBoolean listenerInvoked = new AtomicBoolean();
    vm1.invoke("join the cluster", () -> getSystem().getDistributedMember()); // lead member
    system = getSystem(); // non-lead member
    // this membership listener will be invoked when the shutdown message is received
    system.getDistributionManager().addMembershipListener(new MembershipListener() {
      @Override
      public void memberDeparted(DistributionManager distributionManager,
          InternalDistributedMember id, boolean crashed) {
        assertThat(crashed).isFalse();
        listenerInvoked.set(Boolean.TRUE);
      }
    });
    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().until(listenerInvoked::get);
  }
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