@Override
public void run() {
System.out.println(Thread.currentThread());
RpcClient client = new RpcClient(channelFactory);
RpcChannel channel = client.blockingConnect(serverAddr);
EchoService.BlockingInterface remoteService = EchoService.newBlockingStub(channel);
String payload = new String(new byte[100]);
payload = "Hello";
EchoRequest request = EchoRequest.newBuilder().setPayload(payload).build();
allConnected.countDown();
try {
startLatch.await();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (int i = 0; i < kRequests; ++i) {
EchoResponse response;
try {
response = remoteService.echo(null, request);
assert response.getPayload().equals(payload);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// System.out.println(response);
}
allFinished.countDown();
System.out.println(Thread.currentThread());
// System.out.println(response);
channel.disconnect();
// client.stop();
}