Package com.facebook.thrift.protocol

Examples of com.facebook.thrift.protocol.TBinaryProtocol


  @Test
  public void testkeyValueHeader() throws TException {
    TMemoryBuffer buf = new TMemoryBuffer(200);
    THeaderTransport trans = new THeaderTransport(buf);
    TBinaryProtocol prot = new TBinaryProtocol(trans);
    Xtruct out = new Xtruct();

    trans.setHeader("test1", "value1");
    trans.setHeader("test2", "value2");
    out.write(prot);
View Full Code Here


                            boolean framed, boolean header) throws TException{
    TTransport transport;
    TSocket socket = new TSocket("localhost", TEST_PORT);
    socket.setTimeout(1000);
    transport = socket;
    TProtocol prot = new TBinaryProtocol(transport);
    if (unframed) {
      testClient(transport, prot); // Unframed
    }
    List<THeaderTransport.ClientTypes> clientTypes =
      new ArrayList<THeaderTransport.ClientTypes>();
    prot = new THeaderProtocol(transport, clientTypes);
    if (header) {
      testClient(transport, prot); // Header w/compact
    }
    TFramedTransport framedTransport = new TFramedTransport(transport);
    prot = new TBinaryProtocol(framedTransport);
    if (framed) {
      testClient(transport, prot); // Framed
    }
  }
View Full Code Here

public class JavaClient {
  public static void main(String [] args) {
    try {

      TTransport transport = new TSocket("localhost", 9090);
      TProtocol protocol = new TBinaryProtocol(transport);
      Calculator.Client client = new Calculator.Client(protocol);

      transport.open();

      client.ping();
View Full Code Here

    for (int i = 0; i < 3; ++i) {
      try {
        TSocket sock = new TSocket(host, port, 100, 500);
        sock.open();
        TFramedTransport trans = new TFramedTransport(sock);
        TBinaryProtocol proto = new TBinaryProtocol(trans);
        JavaSimpleService.Client cli = new JavaSimpleService.Client(proto);
        return cli;
      } catch (Exception e) {
        msg = e.toString();
        try {
View Full Code Here

  private static final int MAX_PENDING = 1;

  private static JavaSimpleService.Client newClient() throws Exception {
    TFramedTransport trans = new TFramedTransport(new TSocket(HOST, PORT));
    trans.open();
    return new JavaSimpleService.Client(new TBinaryProtocol(trans));
  }
View Full Code Here

        //Creates a buffer to serialize/deserialize with
        InputStream in = new ByteArrayInputStream(new byte[1]);
        mbuf_in        = new PushbackInputStream(in,10000); //supports 10k msg size
        mbuf_out       = new ByteArrayOutputStream();
        mbuf_transport = new TIOStreamTransport(mbuf_in, mbuf_out);
        mbuf_protocol  = new TBinaryProtocol(mbuf_transport);
    }
View Full Code Here

    }

    private void connectToThrudoc() throws TException {
        TSocket          socket    = new TSocket("localhost", THRUDOC_PORT );
        TFramedTransport transport = new TFramedTransport(socket);
        TBinaryProtocol  protocol  = new TBinaryProtocol(transport);
        
        thrudoc = new Thrudoc.Client(protocol);

        transport.open();
    }
View Full Code Here

    }

    private void connectToThrudex() throws TException {
        TSocket          socket    = new TSocket("localhost", THRUDEX_PORT );
        TFramedTransport transport = new TFramedTransport(socket);
        TBinaryProtocol  protocol  = new TBinaryProtocol(transport);
        
        thrudex = new Thrudex.Client(protocol);

        transport.open();
    }
View Full Code Here

TOP

Related Classes of com.facebook.thrift.protocol.TBinaryProtocol

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.