ServerLauncher extends AbstractLauncher<String> { public ServerState stop() { final ServerLauncher launcher = getInstance(); if (isStoppable()) { return stopInProcess(); } if (isPidInProcess() && launcher != null) { return launcher.stopInProcess(); } if (getPid() != null) { return stopWithPid(); } if (getWorkingDirectory() != null) { return stopWithWorkingDirectory(); } return new ServerState(this, Status.NOT_RESPONDING); } private  ServerLauncher(final Builder builder); static void main(final String... args); static ServerLauncher getInstance(); static ServerState getServerState(); Cache getCache(); CacheConfig getCacheConfig(); String getId(); Command getCommand(); boolean isAssignBuckets(); boolean isDisableDefaultServer(); boolean isForcing(); boolean isHelping(); boolean isRebalancing(); boolean isRedirectingOutput(); @Override String getLogFileName(); @Override String getMemberName(); @Override Integer getPid(); Properties getProperties(); InetAddress getServerBindAddress(); String getServerBindAddressAsString(); Integer getServerPort(); String getServerPortAsString(); @Override String getServiceName(); String getSpringXmlLocation(); boolean isSpringXmlLocationSpecified(); @Override String getWorkingDirectory(); Float getCriticalHeapPercentage(); Float getEvictionHeapPercentage(); Float getCriticalOffHeapPercentage(); Float getEvictionOffHeapPercentage(); String getHostNameForClients(); Integer getMaxConnections(); Integer getMaxMessageCount(); Integer getMessageTimeToLive(); Integer getMaxThreads(); Integer getSocketBufferSize(); void help(final Command command); void usage(); @Override void run(); ServerState start(); void waitOnServer(); ServerState status(); ServerState stop();  }
@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(); }