### Question:
ClientReceiver extends StreamReceiver { @Override public void shutdown() { m_socketWrapper.close(); super.shutdown(); } private  ClientReceiver(SocketWrapper socketWrapper); static ClientReceiver connect(Connector connector, Address address); @Override void shutdown();  }### Answer:
@Test public void testShutdown() throws Exception { final SocketAcceptorThread socketAcceptor = SocketAcceptorThread.create(); final Connector connector = new Connector(socketAcceptor.getHostName(), socketAcceptor.getPort(), ConnectionType.AGENT); final Address address = new StubAddress(); final Receiver clientReceiver = ClientReceiver.connect(connector, address); socketAcceptor.join(); final Socket acceptedSocket = socketAcceptor.getAcceptedSocket(); assertConnection( acceptedSocket.getInputStream(), ConnectionType.AGENT, address); final OutputStream socketOutput = acceptedSocket.getOutputStream(); final SimpleMessage message1 = new SimpleMessage(); final ObjectOutputStream objectStream1 = new ObjectOutputStream(socketOutput); objectStream1.writeObject(message1); objectStream1.flush(); final Message receivedMessage = clientReceiver.waitForMessage(); assertNotNull(receivedMessage); clientReceiver.shutdown(); assertNull(clientReceiver.waitForMessage()); socketAcceptor.close(); }