Java 类io.grpc.reflection.v1alpha.ServerReflectionGrpc 实例源码

项目:polyglot    文件:ServerReflectionClient.java   
/** Asks the remote server to list its services and completes when the server responds. */
public ListenableFuture<ImmutableList<String>> listServices() {
  ListServicesHandler rpcHandler = new ListServicesHandler();
  StreamObserver<ServerReflectionRequest> requestStream = ServerReflectionGrpc.newStub(channel)
      .withDeadlineAfter(LIST_RPC_DEADLINE_MS, TimeUnit.MILLISECONDS)
      .serverReflectionInfo(rpcHandler);
  return rpcHandler.start(requestStream);
}
项目:polyglot    文件:ServerReflectionClient.java   
/**
 * Returns a {@link FileDescriptorSet} containing all the transitive dependencies of the supplied
 * service, as provided by the remote server.
 */
public ListenableFuture<FileDescriptorSet> lookupService(String serviceName) {
  LookupServiceHandler rpcHandler = new LookupServiceHandler(serviceName);
  StreamObserver<ServerReflectionRequest> requestStream = ServerReflectionGrpc.newStub(channel)
      .withDeadlineAfter(LOOKUP_RPC_DEADLINE_MS, TimeUnit.MILLISECONDS)
      .serverReflectionInfo(rpcHandler);
  return rpcHandler.start(requestStream);
}
项目:grpc-java    文件:ProtoReflectionServiceTest.java   
@Before
public void setUp() throws Exception {
  reflectionService = ProtoReflectionService.newInstance();
  server =
      InProcessServerBuilder.forName("proto-reflection-test")
          .directExecutor()
          .addService(reflectionService)
          .addService(new ReflectableServiceGrpc.ReflectableServiceImplBase() {})
          .fallbackHandlerRegistry(handlerRegistry)
          .build()
          .start();
  channel = InProcessChannelBuilder.forName("proto-reflection-test").directExecutor().build();
  stub = ServerReflectionGrpc.newStub(channel);
}