Examples of TSocket


Examples of com.facebook.presto.hive.shaded.org.apache.thrift.transport.TSocket

    public HiveMetastoreClient create(String host, int port)
            throws TTransportException
    {
        TTransport transport;
        if (socksProxy == null) {
            transport = new TTransportWrapper(new TSocket(host, port, (int) timeout.toMillis()), host);
            transport.open();
        }
        else {
            SocketAddress address = InetSocketAddress.createUnresolved(socksProxy.getHostText(), socksProxy.getPort());
            Socket socks = new Socket(new Proxy(Proxy.Type.SOCKS, address));
            try {
                socks.connect(InetSocketAddress.createUnresolved(host, port), (int) timeout.toMillis());
                socks.setSoTimeout(Ints.checkedCast(timeout.toMillis()));
            }
            catch (IOException e) {
                throw rewriteException(new TTransportException(e), host);
            }
            try {
                transport = new TTransportWrapper(new TSocket(socks), host);
            }
            catch (TTransportException e) {
                throw rewriteException(e, host);
            }
        }
View Full Code Here

Examples of com.facebook.thrift.transport.TSocket

        databasename = parts[1];
        port = Integer.parseInt(hostport[1]);
      }
      catch (Exception e) {
      }
      TTransport transport = new TSocket(host, port);
      TProtocol protocol = new TBinaryProtocol(transport);
      client = new HiveClient(protocol);
      transport.open();
    }
  }
View Full Code Here

Examples of org.apache.blur.thirdparty.thrift_0_9_0.transport.TSocket

  }

  public Client newClient(Connection connection) throws TTransportException, IOException {
    String host = connection.getHost();
    int port = connection.getPort();
    TSocket trans;
    Socket socket;
    if (connection.isProxy()) {
      Proxy proxy = new Proxy(Type.SOCKS, new InetSocketAddress(connection.getProxyHost(), connection.getProxyPort()));
      socket = new Socket(proxy);
    } else {
      socket = new Socket();
    }
    int timeout = connection.getTimeout();
    socket.setTcpNoDelay(true);
    socket.setSoTimeout(timeout);
    socket.connect(new InetSocketAddress(host, port), timeout);
    trans = new TSocket(socket);

    TProtocol proto = new TBinaryProtocol(new TFramedTransport(trans));
    Client client = new Client(proto);
    return client;
  }
View Full Code Here

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

Examples of org.apache.thrift.transport.TSocket

      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

Examples of org.apache.thrift.transport.TSocket

    }
   
    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

Examples of org.apache.thrift.transport.TSocket

    } 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

Examples of org.apache.thrift.transport.TSocket

      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

Examples of org.apache.thrift.transport.TSocket

    @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

Examples of org.apache.thrift.transport.TSocket

    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
TOP
Copyright © 2018 www.massapi.com. 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.