### Question:
ServerReceiver implements Receiver { public synchronized void shutdown() { m_messageQueue.shutdown(); m_executor.shutdownNow(); }  void receiveFrom(Acceptor acceptor,
                          ConnectionType[] connectionTypes,
                          int numberOfThreads,
                          final long idleThreadPollDelay,
                          final long inactiveClientTimeOut); Message waitForMessage(); synchronized void shutdown();  }### Answer:
@Test public void testShutdown() throws Exception { final Acceptor acceptor = new Acceptor("localhost", 0, 1, m_timeAuthority); final ServerReceiver serverReceiver = new ServerReceiver(); serverReceiver.receiveFrom( acceptor, new ConnectionType[] { ConnectionType.AGENT }, 3, 10, 100); final Socket socket = new Connector(InetAddress.getByName(null).getHostName(), acceptor.getPort(), ConnectionType.AGENT) .connect(); final ResourcePool socketSet = acceptor.getSocketSet(ConnectionType.AGENT); for (int i=0; socketSet.countActive() != 1 && i<10; ++i) { Thread.sleep(i * i * 10); } final SimpleMessage message = new SimpleMessage(); final ObjectOutputStream objectStream = new ObjectOutputStream(socket.getOutputStream()); objectStream.writeObject(message); objectStream.flush(); final Message receivedMessage = serverReceiver.waitForMessage(); assertNotNull(receivedMessage); serverReceiver.shutdown(); try { serverReceiver.receiveFrom( acceptor, new ConnectionType[] { ConnectionType.AGENT }, 3, 10, 100); fail("Expected a CommunicationException"); } catch (CommunicationException e) { } assertNull(serverReceiver.waitForMessage()); acceptor.shutdown(); }