com.google.protobuf.Descriptors.MethodDescriptor Java Examples

The following examples show how to use com.google.protobuf.Descriptors.MethodDescriptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockingRpcClient.java    From incubator-tajo with Apache License 2.0 6 votes vote down vote up
public Message callBlockingMethod(final MethodDescriptor method,
                                  final RpcController controller,
                                  final Message param,
                                  final Message responsePrototype)
    throws ServiceException {

  int nextSeqId = sequence.getAndIncrement();

  Message rpcRequest = buildRequest(nextSeqId, method, param);

  ProtoCallFuture callFuture =
      new ProtoCallFuture(controller, responsePrototype);
  requests.put(nextSeqId, callFuture);
  getChannel().write(rpcRequest);

  try {
    return callFuture.get();
  } catch (Throwable t) {
    if(t instanceof ExecutionException) {
      ExecutionException ee = (ExecutionException)t;
      throw new ServiceException(ee.getCause());
    } else {
      throw new RemoteException(t);
    }
  }
}
 
Example #2
Source File: BlockingRpcClient.java    From tajo with Apache License 2.0 6 votes vote down vote up
@Override
public Message callBlockingMethod(final MethodDescriptor method,
                                  final RpcController controller,
                                  final Message param,
                                  final Message responsePrototype)
    throws TajoServiceException {

  int nextSeqId = sequence.getAndIncrement();
  RpcProtos.RpcRequest rpcRequest = buildRequest(nextSeqId, method, param);
  ProtoCallFuture callFuture = new ProtoCallFuture(controller, responsePrototype);

  invoke(rpcRequest, callFuture, 0);

  try {
    return callFuture.get();
  } catch (Throwable t) {
    if (t instanceof ExecutionException) {
      Throwable cause = t.getCause();
      if (cause != null && cause instanceof TajoServiceException) {
        throw (TajoServiceException) cause;
      }
    }
    throw new TajoServiceException(t.getMessage());
  }
}
 
Example #3
Source File: RpcChannelImpl.java    From protobuf-socket-rpc with MIT License 6 votes vote down vote up
private void sendRpcRequest(MethodDescriptor method,
    SocketRpcController socketController, Message request,
    Connection connection) throws ServiceException {
  // Check request
  if (!request.isInitialized()) {
    handleError(socketController, ErrorReason.INVALID_REQUEST_PROTO,
        "Request is uninitialized", null);
  }

  // Create RPC request protobuf
  SocketRpcProtos.Request rpcRequest = SocketRpcProtos.Request.newBuilder()
      .setRequestProto(request.toByteString())
      .setServiceName(method.getService().getFullName())
      .setMethodName(method.getName())
      .build();

  // Send request
  try {
    connection.sendProtoMessage(rpcRequest);
  } catch (IOException e) {
    handleError(socketController, ErrorReason.IO_ERROR, String.format(
        "Error writing over connection %s", connection), e);
  }
}
 
Example #4
Source File: RpcChannelImpl.java    From protobuf-socket-rpc with MIT License 6 votes vote down vote up
@Override
public Message callBlockingMethod(MethodDescriptor method,
    RpcController controller, Message request, Message responsePrototype)
    throws ServiceException {
  // Must pass in a SocketRpcController
  SocketRpcController socketController = (SocketRpcController) controller;
  final Connection connection = createConnection(socketController);
  try {
    sendRpcRequest(method, socketController, request, connection);
    Response rpcResponse = receiveRpcResponse(socketController, connection);
    return handleRpcResponse(responsePrototype, rpcResponse,
        socketController);
  } finally {
    close(connection);
  }
}
 
Example #5
Source File: RpcForwarder.java    From protobuf-socket-rpc with MIT License 6 votes vote down vote up
private void forwardToService(SocketRpcProtos.Request rpcRequest,
    RpcCallback<Message> callback, Service service,
    RpcController socketController) throws RpcException {
  // Get matching method
  MethodDescriptor method = getMethod(rpcRequest,
      service.getDescriptorForType());

  // Create request for method
  Message request = getRequestProto(rpcRequest,
      service.getRequestPrototype(method));

  // Call method
  try {
    service.callMethod(method, socketController, request, callback);
  } catch (RuntimeException e) {
    throw new RpcException(ErrorReason.RPC_ERROR,
        "Error running method " + method.getFullName(), e);
  }
}
 
Example #6
Source File: ServiceTest.java    From travelguide with Apache License 2.0 6 votes vote down vote up
public void testNewReflectiveBlockingService() throws ServiceException {
  ServiceWithNoOuter.BlockingInterface impl =
      control.createMock(ServiceWithNoOuter.BlockingInterface.class);
  RpcController controller = control.createMock(RpcController.class);
  BlockingService service =
      ServiceWithNoOuter.newReflectiveBlockingService(impl);

  MethodDescriptor fooMethod =
      ServiceWithNoOuter.getDescriptor().findMethodByName("Foo");
  MessageWithNoOuter request = MessageWithNoOuter.getDefaultInstance();

  TestAllTypes expectedResponse = TestAllTypes.getDefaultInstance();
  EasyMock.expect(impl.foo(EasyMock.same(controller), EasyMock.same(request)))
      .andReturn(expectedResponse);

  control.replay();

  Message response =
      service.callBlockingMethod(fooMethod, controller, request);
  assertEquals(expectedResponse, response);

  control.verify();
}
 
Example #7
Source File: ProtoReflectionService.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
private void processService(ServiceDescriptor service, FileDescriptor fd) {
  String serviceName = service.getFullName();
  checkState(
      !fileDescriptorsBySymbol.containsKey(serviceName),
      "Service already defined: %s",
      serviceName);
  fileDescriptorsBySymbol.put(serviceName, fd);
  for (MethodDescriptor method : service.getMethods()) {
    String methodName = method.getFullName();
    checkState(
        !fileDescriptorsBySymbol.containsKey(methodName),
        "Method already defined: %s",
        methodName);
    fileDescriptorsBySymbol.put(methodName, fd);
  }
}
 
Example #8
Source File: RemoteCallException.java    From tajo with Apache License 2.0 5 votes vote down vote up
public RemoteCallException(int seqId, MethodDescriptor methodDesc,
                           Throwable t) {
  super("Remote call error occurs when " + methodDesc.getFullName() + "is called:", t);
  this.seqId = seqId;
  if (t != null) {
    originExceptionClass = t.getClass().getCanonicalName();
  }
}
 
Example #9
Source File: MinaRpcPoolChannel.java    From gameserver with Apache License 2.0 5 votes vote down vote up
/**
 * Call the actual RPC logic.
 * @return
 */
private final Callback doCallMethod(MethodDescriptor method, RpcController controller,
		Message request, Message responsePrototype, RpcCallback<Message> done) {
	
	RpcMessage.Builder rpcReqBuilder = RpcMessage.newBuilder();
	rpcReqBuilder.setId(rpcIdCounter.getAndIncrement());
	String serviceName = method.getService().getFullName();
	String methodName = method.getName();
	String className = void.class.getName();
	byte[] content = Constant.EMPTY_BYTES;
	if ( request != null ) {
		className = request.getClass().getName();
		content = request.toByteArray();
	}
	logger.debug("callMethod className: {}, methodName: {}", className, methodName);
	rpcReqBuilder.setClassName(className);
	rpcReqBuilder.setType(Type.REQUEST);
	rpcReqBuilder.setService(serviceName);
	rpcReqBuilder.setMethod(methodName);
	rpcReqBuilder.setPayload(ByteString.copyFrom(content));
	RpcMessage req = rpcReqBuilder.build();
	
	//Save the callback
	Callback callback = new Callback(done, responsePrototype);
	resultMap.put(req.getId(), callback);
	
	//Send this RpcRequest method to server.
	clientPool.sendMessageToServer(req);
	
	return callback;
}
 
Example #10
Source File: MinaRpcChannel.java    From gameserver with Apache License 2.0 5 votes vote down vote up
/**
 * It is the blocking version of RPC.
 */
@Override
public Message callBlockingMethod(MethodDescriptor method,
		RpcController controller, Message request, Message responsePrototype)
		throws ServiceException {

	Callback callback = doCallMethod(method, controller, request, responsePrototype, null);
	return callback.getResponse();
}
 
Example #11
Source File: MinaRpcChannel.java    From gameserver with Apache License 2.0 5 votes vote down vote up
/**
 * Call the actual RPC logic.
 * @return
 */
private final Callback doCallMethod(MethodDescriptor method, RpcController controller,
		Message request, Message responsePrototype, RpcCallback<Message> done) {
	
	RpcMessage.Builder rpcReqBuilder = RpcMessage.newBuilder();
	rpcReqBuilder.setId(rpcIdCounter.getAndIncrement());
	String serviceName = method.getService().getFullName();
	String methodName = method.getName();
	String className = void.class.getName();
	byte[] content = Constant.EMPTY_BYTES;
	if ( request != null ) {
		className = request.getClass().getName();
		content = request.toByteArray();
	}
	logger.debug("callMethod className: {}, methodName: {}", className, methodName);
	rpcReqBuilder.setClassName(className);
	rpcReqBuilder.setType(Type.REQUEST);
	rpcReqBuilder.setService(serviceName);
	rpcReqBuilder.setMethod(methodName);
	rpcReqBuilder.setPayload(ByteString.copyFrom(content));
	RpcMessage req = rpcReqBuilder.build();
	
	//Save the callback
	Callback callback = new Callback(done, responsePrototype);
	resultMap.put(req.getId(), callback);
	
	//Send this RpcRequest method to server.
	simpleClient.sendMessageToServer(req);
	
	return callback;
}
 
Example #12
Source File: BlockingRpcServer.java    From tajo with Apache License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(final ChannelHandlerContext ctx, final RpcRequest request) throws Exception {

  String methodName = request.getMethodName();
  final MethodDescriptor methodDescriptor = service.getDescriptorForType().findMethodByName(methodName);
  if (methodDescriptor == null) {
    exceptionCaught(ctx, new RemoteCallException(request.getId(), new NoSuchMethodException(methodName)));
    return;
  }

  try {
    Message paramProto = null;
    if (request.hasRequestMessage()) {
      paramProto = service.getRequestPrototype(methodDescriptor).newBuilderForType()
          .mergeFrom(request.getRequestMessage()).build();
    }

    RpcController controller = new NettyRpcController();
    Message returnValue = service.callBlockingMethod(methodDescriptor, controller, paramProto);

    RpcProtos.RpcResponse.Builder builder = RpcProtos.RpcResponse.newBuilder().setId(request.getId());

    if (returnValue != null) {
      builder.setResponseMessage(returnValue.toByteString());
    }

    if (controller.failed()) {
      builder.setErrorMessage(controller.errorText());
    }
    ctx.writeAndFlush(builder.build());
  } catch (RemoteCallException e) {
    exceptionCaught(ctx, e);
  } catch (Throwable throwable) {
    exceptionCaught(ctx, new RemoteCallException(request.getId(), methodDescriptor, throwable));
  }
}
 
Example #13
Source File: MinaRpcPoolChannel.java    From gameserver with Apache License 2.0 5 votes vote down vote up
/**
 * It is the blocking version of RPC.
 */
@Override
public Message callBlockingMethod(MethodDescriptor method,
		RpcController controller, Message request, Message responsePrototype)
		throws ServiceException {

	Callback callback = doCallMethod(method, controller, request, responsePrototype, null);
	return callback.getResponse();
}
 
Example #14
Source File: AsyncRpcClient.java    From tajo with Apache License 2.0 5 votes vote down vote up
public void callMethod(final MethodDescriptor method,
                       final RpcController controller,
                       final Message param,
                       final Message responseType,
                       final RpcCallback<Message> done) {

  int nextSeqId = sequence.getAndIncrement();
  RpcProtos.RpcRequest rpcRequest = buildRequest(nextSeqId, method, param);

  invoke(rpcRequest, new ResponseCallback(controller, responseType, done), 0);
}
 
Example #15
Source File: ServerRpcProvider.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Register all methods provided by the given service type.
 */
public void registerService(Service service) {
  synchronized (registeredServices) {
    for (MethodDescriptor methodDescriptor : service.getDescriptorForType().getMethods()) {
      registeredServices.put(methodDescriptor.getInputType(),
          new RegisteredServiceMethod(service, methodDescriptor));
    }
  }
}
 
Example #16
Source File: WebSocketClientRpcChannel.java    From swellrt with Apache License 2.0 5 votes vote down vote up
@Override
public void callMethod(MethodDescriptor method, RpcController genericRpcController,
    Message request, Message responsePrototype, RpcCallback<Message> callback) {
  // Cast the given generic controller to a ClientRpcController.
  final ClientRpcController controller;
  if (genericRpcController instanceof ClientRpcController) {
    controller = (ClientRpcController) genericRpcController;
  } else {
    throw new IllegalArgumentException("Expected ClientRpcController, got: "
        + genericRpcController.getClass());
  }

  // Generate a new sequence number, and configure the controller - notably,
  // this throws an IllegalStateException if it is *already* configured.
  final int sequenceNo = lastSequenceNumber.incrementAndGet();
  final ClientRpcController.RpcState rpcStatus =
      new ClientRpcController.RpcState(this, method.getOptions()
          .getExtension(Rpc.isStreamingRpc), callback, new Runnable() {
        @Override
        public void run() {
          clientChannel.sendMessage(sequenceNo, Rpc.CancelRpc.getDefaultInstance());
        }
      });
  controller.configure(rpcStatus);
  synchronized (activeMethodMap) {
    activeMethodMap.put(sequenceNo, controller);
  }
  LOG.fine("Calling a new RPC (seq " + sequenceNo + "), method " + method.getFullName() + " for "
      + clientChannel);

  // Kick off the RPC by sending the request to the server end-point.
  clientChannel.sendMessage(sequenceNo, request, responsePrototype);
}
 
Example #17
Source File: BlockingRpcClient.java    From incubator-tajo with Apache License 2.0 5 votes vote down vote up
private Message buildRequest(int seqId,
                             MethodDescriptor method,
                             Message param) {
  RpcRequest.Builder requestBuilder = RpcRequest.newBuilder()
      .setId(seqId)
      .setMethodName(method.getName());

  if (param != null) {
    requestBuilder.setRequestMessage(param.toByteString());
  }

  return requestBuilder.build();
}
 
Example #18
Source File: ServiceResolver.java    From milkman with MIT License 5 votes vote down vote up
private MethodDescriptor resolveServiceMethod(
    String serviceName, String methodName, String packageName) {
  ServiceDescriptor service = findService(serviceName, packageName);
  MethodDescriptor method = service.findMethodByName(methodName);
  if (method == null) {
    throw new IllegalArgumentException(
        "Unable to find method " + methodName + " in service " + serviceName);
  }
  return method;
}
 
Example #19
Source File: GrpcDocServicePlugin.java    From armeria with Apache License 2.0 5 votes vote down vote up
private static List<String> defaultExamples(MethodDescriptor method) {
    try {
        final DynamicMessage defaultInput = DynamicMessage.getDefaultInstance(method.getInputType());
        final String serialized = defaultExamplePrinter.print(defaultInput).trim();
        if ("{\n}".equals(serialized) || "{}".equals(serialized)) {
            // Ignore an empty object.
            return ImmutableList.of();
        }
        return ImmutableList.of(serialized);
    } catch (InvalidProtocolBufferException e) {
        return ImmutableList.of();
    }
}
 
Example #20
Source File: GrpcDocServicePlugin.java    From armeria with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
static MethodInfo newMethodInfo(MethodDescriptor method, ServiceEntry service) {
    final Set<EndpointInfo> methodEndpoints =
            service.endpointInfos.stream()
                                 .map(e -> {
                                     final EndpointInfoBuilder builder = EndpointInfo.builder(
                                             e.hostnamePattern(), e.pathMapping() + method.getName());
                                     if (e.fragment() != null) {
                                         builder.fragment(e.fragment());
                                     }
                                     if (e.defaultMimeType() != null) {
                                         builder.defaultMimeType(e.defaultMimeType());
                                     }
                                     return builder.availableMimeTypes(e.availableMimeTypes()).build();
                                 })
                                 .collect(toImmutableSet());
    return new MethodInfo(
            method.getName(),
            namedMessageSignature(method.getOutputType()),
            // gRPC methods always take a single request parameter of message type.
            ImmutableList.of(FieldInfo.builder("request", namedMessageSignature(method.getInputType()))
                                      .requirement(FieldRequirement.REQUIRED).build()),
            /* exceptionTypeSignatures */ ImmutableList.of(),
            methodEndpoints,
            /* exampleHttpHeaders */ ImmutableList.of(),
            defaultExamples(method),
            /* examplePaths */ ImmutableList.of(),
            /* exampleQueries */ ImmutableList.of(),
            HttpMethod.POST,
            /* docString */ null);
}
 
Example #21
Source File: GrpcReflectionUtils.java    From grpc-swagger with MIT License 5 votes vote down vote up
public static MethodType fetchMethodType(MethodDescriptor methodDescriptor) {
    boolean clientStreaming = methodDescriptor.toProto().getClientStreaming();
    boolean serverStreaming = methodDescriptor.toProto().getServerStreaming();
    if (clientStreaming && serverStreaming) {
        return MethodType.BIDI_STREAMING;
    } else if (!clientStreaming && !serverStreaming) {
        return MethodType.UNARY;
    } else if (!clientStreaming) {
        return MethodType.SERVER_STREAMING;
    } else {
        return MethodType.SERVER_STREAMING;
    }
}
 
Example #22
Source File: GrpcProxyService.java    From grpc-swagger with MIT License 5 votes vote down vote up
public CallResults invokeMethod(GrpcMethodDefinition definition, Channel channel, CallOptions callOptions,
        List<String> requestJsonTexts) {
    FileDescriptorSet fileDescriptorSet = GrpcReflectionUtils.resolveService(channel, definition.getFullServiceName());
    if (fileDescriptorSet == null) {
        return null;
    }
    ServiceResolver serviceResolver = ServiceResolver.fromFileDescriptorSet(fileDescriptorSet);
    MethodDescriptor methodDescriptor = serviceResolver.resolveServiceMethod(definition);
    TypeRegistry registry = TypeRegistry.newBuilder().add(serviceResolver.listMessageTypes()).build();
    List<DynamicMessage> requestMessages = GrpcReflectionUtils.parseToMessages(registry, methodDescriptor.getInputType(),
            requestJsonTexts);
    CallResults results = new CallResults();
    StreamObserver<DynamicMessage> streamObserver = MessageWriter.newInstance(registry, results);
    CallParams callParams = CallParams.builder()
            .methodDescriptor(methodDescriptor)
            .channel(channel)
            .callOptions(callOptions)
            .requests(requestMessages)
            .responseObserver(streamObserver)
            .build();
    try {
        grpcClientService.call(callParams).get();
    } catch (InterruptedException | ExecutionException e) {
        throw new RuntimeException("Caught exception while waiting for rpc", e);
    }
    return results;
}
 
Example #23
Source File: RpcForwarder.java    From protobuf-socket-rpc with MIT License 5 votes vote down vote up
/**
 * Get matching method.
 */
private MethodDescriptor getMethod(SocketRpcProtos.Request rpcRequest,
    ServiceDescriptor descriptor) throws RpcException {
  MethodDescriptor method = descriptor.findMethodByName(
      rpcRequest.getMethodName());
  if (method == null) {
    throw new RpcException(
        ErrorReason.METHOD_NOT_FOUND,
        String.format("Could not find method %s in service %s",
            rpcRequest.getMethodName(), descriptor.getFullName()),
        null);
  }
  return method;
}
 
Example #24
Source File: GrpcClientService.java    From grpc-swagger with MIT License 5 votes vote down vote up
private io.grpc.MethodDescriptor<DynamicMessage, DynamicMessage> createGrpcMethodDescriptor(MethodDescriptor descriptor) {
    return io.grpc.MethodDescriptor.<DynamicMessage, DynamicMessage>newBuilder()
            .setType(fetchMethodType(descriptor))
            .setFullMethodName(fetchFullMethodName(descriptor))
            .setRequestMarshaller(new DynamicMessageMarshaller(descriptor.getInputType()))
            .setResponseMarshaller(new DynamicMessageMarshaller(descriptor.getOutputType()))
            .build();
}
 
Example #25
Source File: DescriptorsTest.java    From travelguide with Apache License 2.0 5 votes vote down vote up
public void testServiceDescriptor() throws Exception {
  ServiceDescriptor service = TestService.getDescriptor();

  assertEquals("TestService", service.getName());
  assertEquals("protobuf_unittest.TestService", service.getFullName());
  assertEquals(UnittestProto.getDescriptor(), service.getFile());

  assertEquals(2, service.getMethods().size());

  MethodDescriptor fooMethod = service.getMethods().get(0);
  assertEquals("Foo", fooMethod.getName());
  assertEquals(UnittestProto.FooRequest.getDescriptor(),
               fooMethod.getInputType());
  assertEquals(UnittestProto.FooResponse.getDescriptor(),
               fooMethod.getOutputType());
  assertEquals(fooMethod, service.findMethodByName("Foo"));

  MethodDescriptor barMethod = service.getMethods().get(1);
  assertEquals("Bar", barMethod.getName());
  assertEquals(UnittestProto.BarRequest.getDescriptor(),
               barMethod.getInputType());
  assertEquals(UnittestProto.BarResponse.getDescriptor(),
               barMethod.getOutputType());
  assertEquals(barMethod, service.findMethodByName("Bar"));

  assertNull(service.findMethodByName("NoSuchMethod"));

  for (int i = 0; i < service.getMethods().size(); i++) {
    assertEquals(i, service.getMethods().get(i).getIndex());
  }
}
 
Example #26
Source File: ServiceResolver.java    From grpc-swagger with MIT License 5 votes vote down vote up
/**
 * Returns the descriptor of a protobuf method with the supplied grpc method name. If the method
 * cannot be found, this throws {@link IllegalArgumentException}.
 */
public MethodDescriptor resolveServiceMethod(GrpcMethodDefinition definition) {

    ServiceDescriptor service = findService(definition.getPackageName(), definition.getServiceName());
    MethodDescriptor method = service.findMethodByName(definition.getMethodName());
    if (method == null) {
        throw new IllegalArgumentException(
                "Unable to find method " + definition.getMethodName()
                        + " in service " + definition.getServiceName());
    }
    return method;
}
 
Example #27
Source File: ServiceTest.java    From travelguide with Apache License 2.0 5 votes vote down vote up
public void testNewReflectiveService() {
  ServiceWithNoOuter.Interface impl =
      control.createMock(ServiceWithNoOuter.Interface.class);
  RpcController controller = control.createMock(RpcController.class);
  Service service = ServiceWithNoOuter.newReflectiveService(impl);

  MethodDescriptor fooMethod =
      ServiceWithNoOuter.getDescriptor().findMethodByName("Foo");
  MessageWithNoOuter request = MessageWithNoOuter.getDefaultInstance();
  RpcCallback<Message> callback = new RpcCallback<Message>() {
    public void run(Message parameter) {
      // No reason this should be run.
      fail();
    }
  };
  RpcCallback<TestAllTypes> specializedCallback =
      RpcUtil.specializeCallback(callback);

  impl.foo(EasyMock.same(controller), EasyMock.same(request),
      EasyMock.same(specializedCallback));
  EasyMock.expectLastCall();

  control.replay();

  service.callMethod(fooMethod, controller, request, callback);

  control.verify();
}
 
Example #28
Source File: AsyncRpcClient.java    From incubator-tajo with Apache License 2.0 5 votes vote down vote up
public void callMethod(final MethodDescriptor method,
                       final RpcController controller,
                       final Message param,
                       final Message responseType,
                       RpcCallback<Message> done) {

  int nextSeqId = sequence.getAndIncrement();

  Message rpcRequest = buildRequest(nextSeqId, method, param);

  handler.registerCallback(nextSeqId,
      new ResponseCallback(controller, responseType, done));

  getChannel().write(rpcRequest);
}
 
Example #29
Source File: AsyncRpcClient.java    From incubator-tajo with Apache License 2.0 5 votes vote down vote up
private Message buildRequest(int seqId,
                             MethodDescriptor method,
                             Message param) {

  RpcRequest.Builder requestBuilder = RpcRequest.newBuilder()
      .setId(seqId)
      .setMethodName(method.getName());

  if (param != null) {
      requestBuilder.setRequestMessage(param.toByteString());
  }

  return requestBuilder.build();
}
 
Example #30
Source File: ServiceResolver.java    From milkman with MIT License 5 votes vote down vote up
/**
 * Returns the descriptor of a protobuf method with the supplied grpc method name. If the method
 * cannot be found, this throws {@link IllegalArgumentException}.
 */
public MethodDescriptor resolveServiceMethod(ProtoMethodName method) {
  return resolveServiceMethod(
      method.getServiceName(),
      method.getMethodName(),
      method.getPackageName());
}