Package org.apache.avro.ipc

Examples of org.apache.avro.ipc.HttpTransceiver


    server =
      new HttpServer(new SpecificResponder(BulkData.class, new BulkDataImpl()),
                     0);
    server.start();
    client =
      new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/"));
    proxy = (BulkData)SpecificRequestor.getClient(BulkData.class, client);
  }
View Full Code Here


public class TestClient {
  public static void main (String[] args) throws IOException, MalformedURLException {
    Protocol protocol = Protocol.parse(new File("test-proto.avpr"));

    HttpTransceiver transceiver = new HttpTransceiver(new URL("http://localhost:8080"));
    GenericRequestor requestor = new GenericRequestor(protocol, transceiver);

    GenericData.Record message = new GenericData.Record(protocol.getType("Message"));
    message.put("data", new Utf8("Hello from Client"));
View Full Code Here

    request("delete", request);
  }

  private Object request (String msg, Object request) throws IOException {
    HttpTransceiver transceiver = new HttpTransceiver(url);
    GenericRequestor requestor = new GenericRequestor(protocol, transceiver);
    return(requestor.request(msg, request));
  }
View Full Code Here

    }
  }
 
  @Test(expected = Exception.class)
  public void testConnectionRefusedOneWay() throws IOException {
    Transceiver client = new HttpTransceiver(new URL("http://localhost:4444"));
    SpecificRequestor req = new SpecificRequestor(Simple.class, client);
    addRpcPlugins(req);
    Simple proxy = SpecificRequestor.getClient(Simple.class, (SpecificRequestor)req);
    proxy.ack();
  }
View Full Code Here

    return new HttpServer(testResponder, 0);
  }
 
  @Override
  public Transceiver createTransceiver() throws Exception{
    return new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/"));
  }
View Full Code Here

  }

  @Test(expected=SocketTimeoutException.class)
    public void testTimeout() throws Throwable {
    ServerSocket s = new ServerSocket(0);
    HttpTransceiver client =
      new HttpTransceiver(new URL("http://127.0.0.1:"+s.getLocalPort()+"/"));
    client.setTimeout(100);
    Simple proxy = SpecificRequestor.getClient(Simple.class, client);
    try {
      proxy.hello("foo");
    } catch (UndeclaredThrowableException e) {
      throw e.getCause();
View Full Code Here

        super(endpoint);
    }

    @Override
    public Transceiver createTransceiver() throws Exception {
        return new HttpTransceiver(new URL(URISupport.normalizeUri(getEndpoint().getEndpointUri())));
    }
View Full Code Here

    static int avroPort = setupFreePort("avroport");

    @Override
    protected void initializeTranceiver() throws IOException {
        transceiver = new HttpTransceiver(new URL("http://localhost:" + avroPort));
        requestor = new SpecificRequestor(KeyValueProtocol.class, transceiver);
    }
View Full Code Here

    Assert.assertEquals("Server is started", LifecycleState.START,
        source.getLifecycleState());

    // setup a requester, to send a flume OG event
    URL url = new URL("http", "0.0.0.0", selectedPort, "/");
    Transceiver http = new HttpTransceiver(url);
    FlumeOGEventAvroServer client = SpecificRequestor.getClient(
        FlumeOGEventAvroServer.class, http);

    AvroFlumeOGEvent avroEvent =  AvroFlumeOGEvent.newBuilder().setHost("foo").
        setPriority(Priority.INFO).setNanos(0).setTimestamp(1).
View Full Code Here

    server =
      new HttpServer(new SpecificResponder(BulkData.class, new BulkDataImpl()),
                     0);
    server.start();
    client =
      new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/"));
    proxy = SpecificRequestor.getClient(BulkData.class, client);
  }
View Full Code Here

TOP

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

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.