Package com.googlecode.protobuf.socketrpc.TestProtos

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


   * Error while creating socket
   */
  public void testIOErrorWhileCreatingSocket() {
    // Create data
    String reqdata = "Request Data";
    Request request = Request.newBuilder().setStrData(reqdata).build();

    // Create channel
    SocketRpcChannel rpcChannel = new SocketRpcChannel("host", -1,
        new FakeSocketFactory().throwsException(new IOException()));

View Full Code Here


   * Rpc called with incomplete request proto
   */
  public void testIncompleteRequest() throws IOException {
    // Create data
    String resdata = "Response Data";
    Request request = Request.newBuilder().buildPartial(); // required missing
    Response response = Response.newBuilder().setStrData(resdata).build();

    // Create channel
    FakeSocket socket = new FakeSocket(false).withResponseProto(response);
    SocketRpcChannel rpcChannel = new SocketRpcChannel("host", -1,
View Full Code Here

   * RPC doesn't invoke callback.
   */
  public void testNoCallBack() throws IOException {
    // Create data
    String reqdata = "Request Data";
    Request request = Request.newBuilder().setStrData(reqdata).build();

    // Create channel
    FakeSocket socket = new FakeSocket(false).withNoResponse(false);
    SocketRpcChannel rpcChannel = new SocketRpcChannel("host", -1,
        new FakeSocketFactory().returnsSocket(socket));
View Full Code Here

   * RPC invokes callback with null.
   */
  public void testNullCallBack() throws IOException {
    // Create data
    String reqdata = "Request Data";
    Request request = Request.newBuilder().setStrData(reqdata).build();

    // Create channel
    FakeSocket socket = new FakeSocket(false).withNoResponse(true);
    SocketRpcChannel rpcChannel = new SocketRpcChannel("host", -1,
        new FakeSocketFactory().returnsSocket(socket));
View Full Code Here

   * Server responds with bad data
   */
  public void testBadResponse() throws IOException {
    // Create data
    String reqdata = "Request Data";
    Request request = Request.newBuilder().setStrData(reqdata).build();

    // Create channel
    FakeSocket socket = new FakeSocket(false)
        .withInputBytes("bad response".getBytes());
    SocketRpcChannel rpcChannel = new SocketRpcChannel("host", -1,
View Full Code Here

   * RPC responds with bad response proto
   */
  public void testBadResponseProto() throws IOException {
    // Create data
    String reqdata = "Request Data";
    Request request = Request.newBuilder().setStrData(reqdata).build();

    // Create channel
    FakeSocket socket = new FakeSocket(false).withResponseProto(ByteString
        .copyFrom("bad response".getBytes()));
    SocketRpcChannel rpcChannel = new SocketRpcChannel("host", -1,
View Full Code Here

   * RPC responds with incomplete response.
   */
  public void testIncompleteResponse() throws IOException {
    // Create data
    String reqdata = "Request Data";
    Request request = Request.newBuilder().setStrData(reqdata).build();
    // incomplete response
    Response response = Response.newBuilder().setIntData(5).buildPartial();

    // Create channel
    FakeSocket socket = new FakeSocket(false).withResponseProto(response);
View Full Code Here

  }

  private void checkResponseWithError(ErrorReason reason) throws IOException {
    // Create data
    String reqdata = "Request Data";
    Request request = Request.newBuilder().setStrData(reqdata).build();
    String error = "Error String";

    // Create channel
    FakeSocket socket = new FakeSocket(false).withErrorResponseProto(error,
        reason);
View Full Code Here

TOP

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

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.