}
private Response callSync(SocketRpcChannel rpcChannel,
Request request, ErrorReason reason) {
SocketRpcController controller = rpcChannel.newRpcController();
BlockingInterface service = TestService.newBlockingStub(rpcChannel);
try {
Response response = service.testMethod(controller, request);
assertNull(reason);
return response;
} catch (ServiceException e) {
assertEquals(reason, controller.errorReason());
return null;