### Question:
NIOServerCnxnFactory extends ServerCnxnFactory { public void shutdown() { try { stop(); join(); closeAll(ServerCnxn.DisconnectReason.SERVER_SHUTDOWN); if (login != null) { login.shutdown(); } } catch (InterruptedException e) { LOG.warn("Ignoring interrupted exception during shutdown", e); } catch (Exception e) { LOG.warn("Ignoring unexpected exception during shutdown", e); } if (zkServer != null) { zkServer.shutdown(); } } NIOServerCnxnFactory(); static ByteBuffer getDirectBuffer(); @Override void configure(InetSocketAddress addr, int maxcc, int backlog, boolean secure); @Override void reconfigure(InetSocketAddress addr); int getMaxClientCnxnsPerHost(); void setMaxClientCnxnsPerHost(int max); int getSocketListenBacklog(); @Override void start(); @Override void startup(ZooKeeperServer zks, boolean startServer); @Override InetSocketAddress getLocalAddress(); @Override int getLocalPort(); boolean removeCnxn(NIOServerCnxn cnxn); void touchCnxn(NIOServerCnxn cnxn); @Override @SuppressWarnings("unchecked") void closeAll(ServerCnxn.DisconnectReason reason); void stop(); void shutdown(); @Override void join(); @Override Iterable<ServerCnxn> getConnections(); void dumpConnections(PrintWriter pwriter); @Override void resetAllConnectionStats(); @Override Iterable<Map<String, Object>> getAllConnectionInfo(boolean brief); static final String ZOOKEEPER_NIO_SESSIONLESS_CNXN_TIMEOUT; static final String ZOOKEEPER_NIO_NUM_SELECTOR_THREADS; static final String ZOOKEEPER_NIO_NUM_WORKER_THREADS; static final String ZOOKEEPER_NIO_DIRECT_BUFFER_BYTES; static final String ZOOKEEPER_NIO_SHUTDOWN_TIMEOUT; }### Answer:
@Test public void testShutdownWithoutStart_SocketReleased() throws IOException { factory.shutdown(); factory = null; ServerSocket ss = new ServerSocket(listenAddress.getPort()); ss.close(); }