in tchannel-example/src/main/java/com/uber/tchannel/json/JsonClient.java [35:56]
public static void main(String[] args) throws InterruptedException, java.util.concurrent.ExecutionException {
final TChannel tchannel = new TChannel.Builder("json-server").build();
JsonRequest<RequestPojo> req = new JsonRequest.Builder<RequestPojo>(
"json-server",
"json-endpoint")
.setBody(new RequestPojo(0, "hello?"))
.setTimeout(1000)
.build();
TFuture<JsonResponse<ResponsePojo>> p = tchannel
.makeSubChannel("json-service").send(
req,
TChannelUtilities.getCurrentIp(),
8888
);
try (JsonResponse<ResponsePojo> res = p.get()) {
System.out.println(res);
}
tchannel.shutdown();
}