Package org.apache.thrift.protocol

Examples of org.apache.thrift.protocol.TBinaryProtocol$Factory


        if (framed) {
          transport = new TFramedTransport(transport);
        }
      }

      TBinaryProtocol binaryProtocol =
        new TBinaryProtocol(transport);
      ThriftTest.Client testClient =
        new ThriftTest.Client(binaryProtocol);
      Insanity insane = new Insanity();

      long timeMin = 0;
View Full Code Here


  public void testSerialization() throws Exception {
    TestUnion union = new TestUnion(TestUnion._Fields.I32_FIELD, 25);

    TMemoryBuffer buf = new TMemoryBuffer(0);
    TProtocol proto = new TBinaryProtocol(buf);

    union.write(proto);

    TestUnion u2 = new TestUnion();

    u2.read(proto);

    assertEquals(u2, union);

    StructWithAUnion swau = new StructWithAUnion(u2);

    buf = new TMemoryBuffer(0);
    proto = new TBinaryProtocol(buf);

    swau.write(proto);

    StructWithAUnion swau2 = new StructWithAUnion();
    assertFalse(swau2.equals(swau));
    swau2.read(proto);
    assertEquals(swau2, swau);

    // this should NOT throw an exception.
    buf = new TMemoryBuffer(0);
    proto = new TBinaryProtocol(buf);

    swau.write(proto);
    new Empty().read(proto);
  }
View Full Code Here

    private void setup(String server, int port) throws Exception
    {
        /* Establish a thrift connection to the cassandra instance */
        TSocket socket = new TSocket(server, port);
        System.out.println(" connected to " + server + ":" + port + ".");
        TBinaryProtocol binaryProtocol = new TBinaryProtocol(new TFramedTransport(socket));
        Cassandra.Client cassandraClient = new Cassandra.Client(binaryProtocol);
        socket.open();
        thriftClient = cassandraClient;
    }
View Full Code Here

  public void testSerialization() throws Exception {
    TestUnion union = new TestUnion(TestUnion._Fields.I32_FIELD, 25);

    TMemoryBuffer buf = new TMemoryBuffer(0);
    TProtocol proto = new TBinaryProtocol(buf);

    union.write(proto);

    TestUnion u2 = new TestUnion();

    u2.read(proto);

    assertEquals(u2, union);

    StructWithAUnion swau = new StructWithAUnion(u2);

    buf = new TMemoryBuffer(0);
    proto = new TBinaryProtocol(buf);

    swau.write(proto);

    StructWithAUnion swau2 = new StructWithAUnion();
    assertFalse(swau2.equals(swau));
    swau2.read(proto);
    assertEquals(swau2, swau);

    // this should NOT throw an exception.
    buf = new TMemoryBuffer(0);
    proto = new TBinaryProtocol(buf);

    swau.write(proto);
    new Empty().read(proto);
  }
View Full Code Here

    @Override
    public void start() throws Exception {
        log.info(String.format("Starting Hive Thrift/Client on [%s][%d]...", host, port));

        TSocket transport = new TSocket(host, port, (int) TimeUnit.MINUTES.toMillis(2));
        client = new HiveClient(new TBinaryProtocol(transport));
        transport.open();
    }
View Full Code Here

  @Test
  public void testScribeMessage() throws Exception {
    TTransport transport = new TFramedTransport(new TSocket("localhost", port));

    TProtocol protocol = new TBinaryProtocol(transport);
    Scribe.Client client = new Scribe.Client(protocol);
    transport.open();
    LogEntry logEntry = new LogEntry("INFO", "Sending info msg to scribe source");
    List<LogEntry> logEntries = new ArrayList<LogEntry>(1);
    logEntries.add(logEntry);
View Full Code Here

  @Test
  public void testScribeMultipleMessages() throws Exception {
    TTransport transport = new TFramedTransport(new TSocket("localhost", port));

    TProtocol protocol = new TBinaryProtocol(transport);
    Scribe.Client client = new Scribe.Client(protocol);
    transport.open();

    List<LogEntry> logEntries = new ArrayList<LogEntry>(10);
    for (int i = 0; i < 10; i++) {
View Full Code Here

    return true;
  }

  protected HiveClient createHiveClient() {
    TSocket transport = new TSocket(host, port, timeout);
    HiveClient hive = new HiveClient(new TBinaryProtocol(transport));

    try {
      transport.open();

      if (!CollectionUtils.isEmpty(scripts)) {
View Full Code Here

  private static final int SECONDS = 1000;

  public Connection(String host, int port) throws TTransportException {
    TSocket socket = new TSocket(host, port);
    socket.setTimeout(10 * SECONDS);
    TProtocol protocol = new TBinaryProtocol(socket);

    client = new Classifier.Client(protocol);
    this.transport = socket;
    this.transport.open();
  }
View Full Code Here

    TSocket socket = new TSocket(server_, port);
    if(transport_ != null)
      transport_.close();
    transport_ = socket;

    TBinaryProtocol binaryProtocol = new TBinaryProtocol(transport_, false,
        false);
    Cassandra.Client peerstorageClient = new Cassandra.Client(
        binaryProtocol);
    try
    {
View Full Code Here

TOP

Related Classes of org.apache.thrift.protocol.TBinaryProtocol$Factory

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.