code: def testServiceStub(self):
      class MockRpcChannel(service.RpcChannel):
          def CallMethod(
              self,
              method,
              controller,
              request,
              response_class,
              callback,
          ):
              self.method = method
              self.controller = controller
              self.request = request
              callback(response_class())
  
      self.callback_response = None
  
      def MyCallback(response):
          self.callback_response = response
  
      channel = MockRpcChannel()
      stub = unittest_pb2.TestService_Stub(channel)
      rpc_controller = "controller"
      request = "request"
  
      # GetDescriptor now static, still works as instance method for compatability
      self.assertEqual(
          unittest_pb2.TestService_Stub.GetDescriptor(),
          stub.GetDescriptor(),
      )
  
      # Invoke method.
      stub.Foo(rpc_controller, request, MyCallback)
  
      self.assertTrue(
          isinstance(self.callback_response, unittest_pb2.FooResponse)
      )
      self.assertEqual(request, channel.request)
      self.assertEqual(rpc_controller, channel.controller)
      self.assertEqual(stub.GetDescriptor().methods[0], channel.method)
  
file_path: coremltools/deps/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py
imports: import unittest
  from google.protobuf import unittest_pb2
  from google.protobuf import service_reflection
  from google.protobuf import service
label_desc: Use image node_id 2 for calling the FooUnitTest obj's underlying member method code with example usage: obj.testServiceStub() without return types