Skip to content

Instantly share code, notes, and snippets.

@julianshen
Created December 27, 2011 13:57
Show Gist options
  • Save julianshen/1523729 to your computer and use it in GitHub Desktop.
Save julianshen/1523729 to your computer and use it in GitHub Desktop.
import com.thrift.gen.*;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TTransportException;
public class TestClient {
public static void main(String[] args) {
TTransport transport;
try {
transport = new TSocket("localhost", 6116);
transport = new TFramedTransport(transport);
TProtocol protocol = new TBinaryProtocol(transport);
Computer.Client client = new Computer.Client(protocol);
transport.open();
System.out.println(client.add(4, 5));
//transport.close();
} catch (TTransportException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment