NestedZookeeperServers { public void closeServer(final int port) { TestingServer nestedServer = nestedServers.get(port); if (null == nestedServer) { return; } try { nestedServer.close(); nestedServers.remove(port); } catch (final IOException ex) { RegExceptionHandler.handleException(ex); } }  static NestedZookeeperServers getInstance(); synchronized void startServerIfNotStarted(final int port, final String dataDir); void closeServer(final int port);  }
@Test public void assertCloseServerIfNotStarted() throws NoSuchFieldException, SecurityException { nestedZookeeperServers.closeServer(6666); assertFalse(getNestedServers().containsKey(6666)); }