Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bsideup
Created April 7, 2015 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsideup/bccb43ef3ccfa3542f34 to your computer and use it in GitHub Desktop.
Save bsideup/bccb43ef3ccfa3542f34 to your computer and use it in GitHub Desktop.
+ @Autowired
+ ThriftCodecManager thriftCodecManager;
+
@Value("${local.server.port}")
protected int port;
-
- protected TCalculatorService.Iface client;
+
+ protected TCalculatorService client;
@Before
public void setUp() throws Exception {
- TTransport transport = new THttpClient("http://localhost:" + port + "/calculator/");
-
- TProtocol protocol = protocolFactory.getProtocol(transport);
-
- client = new TCalculatorService.Client(protocol);
+ HttpClientConnector connector = new HttpClientConnector(URI.create("http://localhost:" + port + "/thrift/"));
+
+ ThriftClientManager clientManager = new ThriftClientManager(thriftCodecManager);
+ client = clientManager.createClient(connector, TCalculatorService.class).get();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment