### Question:
TcpSocketRpcConnection implements RpcConnection { @Override public InputStream getIncomingStream() { try { return socket.getInputStream(); } catch (IOException e) { log.error("Failed to get incoming stream", e); throw new RuntimeException(e); } } TcpSocketRpcConnection(Socket socket); @Override InputStream getIncomingStream(); @Override OutputStream getOutgoingStream(); @Override void close(); @Override String toString(); static final Logger log; }### Answer:
@Test public void testIncomingStream() { assertEquals(inputStream, tcpSocketRpcConnection.getIncomingStream()); }
@Test(expected = RuntimeException.class) public void testExceptionInOpeningIncomingStream() throws IOException { given(socket.getInputStream()).willThrow(new IOException()); tcpSocketRpcConnection.getIncomingStream(); }