### Question:
Acceptor { public void shutdown() throws CommunicationException { synchronized (m_socketSets) { if (m_isShutdown) { return; } m_isShutdown = true; } try { m_serverSocket.close(); } catch (IOException e) { UncheckedInterruptedException.ioException(e); throw new CommunicationException("Error closing socket", e); } finally { m_executor.shutdownNow(); final ResourcePool[] socketSets = cloneListOfSocketSets(); for (int i = 0; i < socketSets.length; ++i) { socketSets[i].closeCurrentResources(); } m_exceptionQueue.clear(); } } Acceptor(String addressString,
                  int port,
                  int numberOfThreads,
                  TimeAuthority timeAuthority); void shutdown(); int getPort(); Exception getPendingException(); int getNumberOfConnections(); void addListener(ConnectionType connectionType, Listener listener);  }### Answer:
@Test public void testShutdown() throws Exception { final Acceptor acceptor = createAcceptor(3); final ResourcePool socketSet = acceptor.getSocketSet(ConnectionType.AGENT); final Connector connector = new Connector("localhost", acceptor.getPort(), ConnectionType.AGENT); connector.connect(); for (int i = 0; socketSet.countActive() != 1 && i < 10; ++i) { Thread.sleep(i * i * 10); } assertNull(acceptor.peekPendingException()); acceptor.shutdown(); try { acceptor.getSocketSet(ConnectionType.AGENT); fail("Expected Acceptor.ShutdownException"); } catch (Acceptor.ShutdownException e) { } assertTrue(socketSet.reserveNext().isSentinel()); }