ServerLauncher extends AbstractLauncher<String> { public void waitOnServer() { assert getCache() != null : "The Cache Server must first be started with a call to start!"; if (!isServing(getCache())) { Throwable cause = null; try { while (isWaiting(getCache())) { try { synchronized (this) { wait(500L); } } catch (InterruptedException handled) { } } } catch (RuntimeException e) { cause = e; throw e; } finally { failOnStart(cause); } } } 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 reconnectedCacheIsClosed() { Cache cache = mock(Cache.class, "Cache"); Cache reconnectedCache = mock(Cache.class, "ReconnectedCache"); when(cache.isReconnecting()).thenReturn(false).thenReturn(false).thenReturn(true); when(cache.getCacheServers()).thenReturn(Collections.emptyList()); when(cache.getReconnectedCache()).thenReturn(reconnectedCache); new Builder().setCache(cache).build().waitOnServer(); verify(cache, atLeast(3)).isReconnecting(); verify(cache).getReconnectedCache(); verify(reconnectedCache).close(); }