Last active
December 15, 2015 03:28
-
-
Save xiaodongw/5194137 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package com.test.thrift; | |
| import java.util.Calendar; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; | |
| import org.apache.thrift.TException; | |
| import org.apache.thrift.protocol.TCompactProtocol; | |
| import org.apache.thrift.protocol.TProtocol; | |
| import org.apache.thrift.transport.TSocket; | |
| import org.apache.thrift.transport.TTransport; | |
| public class MyClient { | |
| public static void main(String[] args) throws TException { | |
| TTransport transport = new TSocket("localhost",8111); | |
| TProtocol protocol = new TCompactProtocol(transport); | |
| MyService.Client client = new MyService.Client(protocol); | |
| transport.open(); | |
| client.ping(); | |
| client.ping(); | |
| Map<String,Long> values = new HashMap<String, Long>(); | |
| values.put("1", 1L); | |
| client.postTweet(new MyStruct(1, "alfred", values)); | |
| MyStruct s = client.search("query"); | |
| transport.close(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment