Package com.googlecode.protobuf.socketrpc.TestProtos.Request

Examples of com.googlecode.protobuf.socketrpc.TestProtos.Request.Builder


    connection.sendProtoMessage(MESSAGE);
    ByteArrayInputStream is = new ByteArrayInputStream(socket.getOutputBytes());
    assertEquals(MESSAGE, Request.parseDelimitedFrom(is));

    Builder builder = Request.newBuilder();
    connection.receiveProtoMessage(builder);
    assertEquals(MESSAGE, builder.build());
  }
View Full Code Here


    ByteArrayOutputStream os = new ByteArrayOutputStream();
    MESSAGE.writeDelimitedTo(os);
    socket.withInputBytes(os.toByteArray());
    Connection connection = connectionForSocket(socket);

    Builder builder = Request.newBuilder();
    connection.receiveProtoMessage(builder);
    assertEquals(MESSAGE, builder.build());

    connection.sendProtoMessage(MESSAGE);
    ByteArrayInputStream is = new ByteArrayInputStream(socket.getOutputBytes());
    assertEquals(MESSAGE, Request.parseDelimitedFrom(is));
  }
View Full Code Here

    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);
    assertEquals(MESSAGE1, builder.build());
  }
View Full Code Here

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    writeToOutputStream(MESSAGE1, os, isDelimited);
    socket.withInputBytes(os.toByteArray());

    Connection connection = new SocketConnection(socket, isDelimited);
    Builder builder = Request.newBuilder();
    connection.receiveProtoMessage(builder);
    assertEquals(MESSAGE1, builder.build());

    connection.sendProtoMessage(MESSAGE1);
    ByteArrayInputStream is = new ByteArrayInputStream(socket.getOutputBytes());
    assertEquals(MESSAGE1, readFromInputStream(is, isDelimited));
  }
View Full Code Here

    delimited.withInputBytes(os.toByteArray());

    // Send and receive first
    Connection connection = new SocketConnection(delimited, true);
    connection.sendProtoMessage(MESSAGE2);
    Builder builder = Request.newBuilder();
    connection.receiveProtoMessage(builder);
    assertEquals(MESSAGE1, builder.build());

    // Receive and send second
    builder = Request.newBuilder();
    connection.receiveProtoMessage(builder);
    assertEquals(MESSAGE2, builder.build());
    connection.sendProtoMessage(MESSAGE1);

    // Send and receive third
    connection.sendProtoMessage(MESSAGE2);
    builder = Request.newBuilder();
    connection.receiveProtoMessage(builder);
    assertEquals(MESSAGE1, builder.build());

    // Get 3 messages from output
    ByteArrayInputStream is = new ByteArrayInputStream(
        delimited.getOutputBytes());
    assertEquals(MESSAGE2, readFromInputStream(is, true));
View Full Code Here

TOP

Related Classes of com.googlecode.protobuf.socketrpc.TestProtos.Request.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.