@Test
  public void reconnectingDistributedSystemIsDisconnectedOnStop() {
    Cache cache = mock(Cache.class, "Cache");
    DistributedSystem system = mock(DistributedSystem.class, "DistributedSystem");
    Cache reconnectedCache = mock(Cache.class, "ReconnectedCache");
    when(cache.isReconnecting()).thenReturn(true);
    when(cache.getReconnectedCache()).thenReturn(reconnectedCache);
    when(reconnectedCache.isReconnecting()).thenReturn(true);
    when(reconnectedCache.getReconnectedCache()).thenReturn(null);
    when(reconnectedCache.getDistributedSystem()).thenReturn(system);

    ServerLauncher launcher = new Builder().setCache(cache).build();
    launcher.running.set(true);
    launcher.stop();

    verify(cache).isReconnecting();
    verify(cache).getReconnectedCache();
    verify(cache).isReconnecting();
    verify(cache).getReconnectedCache();
    verify(reconnectedCache).getDistributedSystem();
    verify(system).stopReconnecting();
    verify(reconnectedCache).close();
  }
Unit tests for {@link ServerLauncher}.

@since GemFire 7.0
geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java