### Question:
TcpSocketRpcConnection implements RpcConnection { @Override public OutputStream getOutgoingStream() { try { return socket.getOutputStream(); } catch (IOException e) { log.error("Failed to get outgoing 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 testOugtoingStream() { assertEquals(outputStream, tcpSocketRpcConnection.getOutgoingStream()); }
@Test(expected = RuntimeException.class) public void testExceptionInOpeningOutgoingStream() throws IOException { given(socket.getOutputStream()).willThrow(new IOException()); tcpSocketRpcConnection.getOutgoingStream(); }