### Question:
ClientSender extends StreamSender implements BlockingSender { public static ClientSender connect(Connector connector, Address address) throws CommunicationException { return new ClientSender(new SocketWrapper(connector.connect(address))); } private  ClientSender(SocketWrapper socketWrapper); static ClientSender connect(Connector connector, Address address); static ClientSender connect(ClientReceiver clientReceiver); @Override void shutdown(); Message blockingSend(Message message); void sendKeepAlive();  }### Answer:
@Test public void testSend() throws Exception { final SocketAcceptorThread socketAcceptor = SocketAcceptorThread.create(); final Connector connector = new Connector(socketAcceptor.getHostName(), socketAcceptor.getPort(), ConnectionType.AGENT); final Sender clientSender = ClientSender.connect(connector, null); socketAcceptor.join(); final SimpleMessage message1 = new SimpleMessage(); final SimpleMessage message2 = new SimpleMessage(); clientSender.send(message1); clientSender.send(message2); final InputStream socketInput = socketAcceptor.getAcceptedSocket().getInputStream(); assertEquals(ConnectionType.AGENT, Connector.read(socketInput).getConnectionType()); final ObjectInputStream inputStream1 = new ObjectInputStream(socketInput); final Object o1 = inputStream1.readObject(); final ObjectInputStream inputStream2 = new ObjectInputStream(socketInput); final Object o2 = inputStream2.readObject(); assertEquals(message1, o1); assertEquals(message2, o2); assertEquals(0, socketInput.available()); socketAcceptor.close(); try { ClientReceiver.connect(connector, new StubAddress()); fail("Expected CommunicationException"); } catch (CommunicationException e) { } }