Package org.apache.avro.ipc

Examples of org.apache.avro.ipc.SocketTransceiver


    return new SocketServer(responder, new InetSocketAddress(0));
  }
 
  @Override
  public Transceiver createTransceiver() throws Exception {
    return new SocketTransceiver(new InetSocketAddress(server.getPort()));
  }
View Full Code Here


  public void testStartServer() throws Exception {
    if (server != null) return;
    server = new SocketServer(new ReflectResponder(Simple.class, new TestImpl()),
                              new InetSocketAddress(0));
    server.start();
    client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    proxy = ReflectRequestor.getClient(Simple.class, client);
  }
View Full Code Here

  @Before
  public void testStartServer() throws Exception {
    if (server != null) return;
    server = new SocketServer(new TestResponder(), new InetSocketAddress(0));
    server.start();
    client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    requestor = new GenericRequestor(PROTOCOL, client);
  }
View Full Code Here

                             Schema.createRecord(fields),
                             Schema.create(Schema.Type.STRING),
                             Schema.createUnion(new ArrayList<Schema>()));
    protocol.getMessages().put("hello", message);
    Transceiver t
      = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    try {
      GenericRequestor r = new GenericRequestor(protocol, t);
      GenericRecord params = new GenericData.Record(message.getRequest());
      params.put("extra", Boolean.TRUE);
      params.put("greeting", new Utf8("bob"));
      Utf8 response = (Utf8)r.request("hello", params);
      assertEquals(new Utf8("goodbye"), response);
    } finally {
      t.close();
    }
  }
View Full Code Here

      protocol.createMessage("echo", null, Schema.createRecord(params),
                             record,
                             Schema.createUnion(new ArrayList<Schema>()));
    protocol.getMessages().put("echo", message);
    Transceiver t
      = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    try {
      GenericRequestor r = new GenericRequestor(protocol, t);
      GenericRecord args = new GenericData.Record(message.getRequest());
      GenericRecord rec = new GenericData.Record(record);
      rec.put("name", new Utf8("foo"));
      rec.put("kind", new GenericData.EnumSymbol
              (PROTOCOL.getType("Kind"), "BAR"));
      rec.put("hash", new GenericData.Fixed
              (PROTOCOL.getType("MD5"),
               new byte[]{0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5}));
      rec.put("extra", Boolean.TRUE);
      args.put("record", rec);
      GenericRecord response = (GenericRecord)r.request("echo", args);
      assertEquals(rec, response);
    } finally {
      t.close();
    }
  }
View Full Code Here

    return server = new SocketServer(testResponder,
                              new InetSocketAddress(0));  
  }
 
  public Transceiver createTransceiver() throws Exception{
    return new SocketTransceiver(new InetSocketAddress(server.getPort()));
  }
View Full Code Here

      for (File f : SERVER_PORTS_DIR.listFiles()) {
        LineNumberReader reader = new LineNumberReader(new FileReader(f));
        int port = Integer.parseInt(reader.readLine());
        System.out.println("Validating java client to "+
            f.getName()+" - " + port);
        Transceiver client = new SocketTransceiver(
            new InetSocketAddress("localhost", port));
        proxy = (Simple)SpecificRequestor.getClient(Simple.class, client);
        TestProtocolSpecific proto = new TestProtocolSpecific();
        proto.testHello();
        proto.testEcho();
View Full Code Here

    responder.addRPCPlugin(new RPCMetaTestPlugin("key1"));
    responder.addRPCPlugin(new RPCMetaTestPlugin("key2"));
    server = new SocketServer(responder, new InetSocketAddress(0));
    server.start();
   
    client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    requestor = new GenericRequestor(PROTOCOL, client);
    requestor.addRPCPlugin(new RPCMetaTestPlugin("key1"));
    requestor.addRPCPlugin(new RPCMetaTestPlugin("key2"));
  }
View Full Code Here

  public void testStartServer() throws Exception {
    if (server != null) return;
    server = new SocketServer(new SpecificResponder(TestNamespace.class, new TestImpl()),
                              new InetSocketAddress(0));
    server.start();
    client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    proxy = SpecificRequestor.getClient(TestNamespace.class, client);
  }
View Full Code Here

      // start sub-process, connecting back to server
      this.subprocess = startSubprocess(job);
     
      // open client, connecting to sub-process
      this.clientTransceiver =
        new SocketTransceiver(new InetSocketAddress(outputService.inputPort()));
      this.inputClient =
        SpecificRequestor.getClient(InputProtocol.class, clientTransceiver);


    } catch (Exception t) {
View Full Code Here

TOP

Related Classes of org.apache.avro.ipc.SocketTransceiver

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.