ByteArrayOutputStream os = new ByteArrayOutputStream();
writeToOutputStream(MESSAGE1, os, isDelimited);
socket.withInputBytes(os.toByteArray());
Connection connection = new SocketConnection(socket, isDelimited);
connection.sendProtoMessage(MESSAGE1);
ByteArrayInputStream is = new ByteArrayInputStream(socket.getOutputBytes());
assertEquals(MESSAGE1, readFromInputStream(is, isDelimited));
Builder builder = Request.newBuilder();
connection.receiveProtoMessage(builder);