StreamTransportHandler extends TransportHandler { @Override public void initialize() throws IOException { setStreams(new PushbackInputStream(inputStream), outputStream); } StreamTransportHandler(long timeout, ConnectionEndType type, InputStream inputStream,
            OutputStream outputStream); @Override void closeConnection(); @Override void initialize(); InputStream getInputStream(); OutputStream getOutputStream(); @Override boolean isClosed(); @Override void closeClientConnection();  }
@Test public void testInitialize() throws Exception { assertFalse(handler.isInitialized()); handler.initialize(); assertTrue(handler.isInitialized()); }
@Test public void fullTest() throws IOException { handler.initialize(); handler.sendData(new byte[] { 0, 1, 2, 3 }); assertArrayEquals(new byte[] { 0, 1, 2, 3 }, outputStream.toByteArray()); byte[] fetchData = handler.fetchData(); assertArrayEquals(new byte[] { 4, 3, 2, 1 }, fetchData); }