Package org.apache.thrift.transport

Examples of org.apache.thrift.transport.TSocket


      TestHandler handler = new TestHandler();
      ThriftTest.Processor processor = new ThriftTest.Processor(handler);

      startServer(processor, protoFactory);

      TSocket socket = new TSocket(HOST, PORT);
      socket.setTimeout(SOCKET_TIMEOUT);
      TTransport transport = getClientTransport(socket);

      TProtocol protocol = protoFactory.getProtocol(transport);
      ThriftTest.Client testClient = new ThriftTest.Client(protocol);
View Full Code Here


      TTransport transport;

      if (url != null) {
        transport = new THttpClient(url);
      } else {
        TSocket socket = new TSocket(host, port);
        socket.setTimeout(socketTimeout);
        transport = socket;
        if (framed) {
          transport = new TFramedTransport(transport);
        }
      }
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

    } catch (InterruptedException e) {}
  }

  @Override
  public TTransport getTransport() throws Exception {
    TSocket socket = new TSocket(HOST, PORT);
    socket.setTimeout(SOCKET_TIMEOUT);
    return new TFramedTransport(socket);
  }
View Full Code Here

      startServer(processor, protoFactory);

      TTransport transport;

      TSocket socket = new TSocket(HOST, PORT);
      socket.setTimeout(SOCKET_TIMEOUT);
      transport = socket;
      transport = new TFramedTransport(transport);

      TProtocol protocol = protoFactory.getProtocol(transport);
      ThriftTest.Client testClient = new ThriftTest.Client(protocol);
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

    scribeSource.start();
  }

  @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");
View Full Code Here

    tx.close();
  }

  @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();
View Full Code Here

  public boolean isSingleton() {
    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)) {
        HiveUtils.runWithConversion(hive, scripts, false);
      }
    } catch (TTransportException ex) {
View Full Code Here

  private Classifier.Client client;
  private TTransport transport;
  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

TOP

Related Classes of org.apache.thrift.transport.TSocket

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.