Created
December 27, 2011 13:57
-
-
Save julianshen/1523729 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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