Java 类io.grpc.internal.InternalServer 实例源码

项目:armeria    文件:ArmeriaGrpcServerBuilder.java   
@Override
protected InternalServer buildTransportServer(List<Factory> streamTracerFactories) {
    Object registryBuilder = getFieldByReflection("registryBuilder", this, AbstractServerImplBuilder.class);
    Map<String, ServerServiceDefinition> services = getFieldByReflection("services", registryBuilder, null);
    services.values().forEach(grpcServiceBuilder::addService);

    armeriaServerBuilder.serviceUnder("/", grpcServiceBuilder.build()
                                                             .decorate((delegate, ctx, req) -> {
                                                                 ctxCapture.set(ctx);
                                                                 return delegate.serve(ctx, req);
                                                             }));
    return new ArmeriaGrpcServer(armeriaServerBuilder.build());
}
项目:grpc-java    文件:OkHttpTransportTest.java   
@Override
protected InternalServer newServer(List<ServerStreamTracer.Factory> streamTracerFactories) {
  return AccessProtectedHack.serverBuilderBuildTransportServer(
      NettyServerBuilder
        .forPort(0)
        .flowControlWindow(65 * 1024),
      streamTracerFactories,
      fakeClockTransportTracer);
}
项目:grpc-java    文件:OkHttpTransportTest.java   
@Override
protected InternalServer newServer(
    InternalServer server, List<ServerStreamTracer.Factory> streamTracerFactories) {
  int port = server.getPort();
  return AccessProtectedHack.serverBuilderBuildTransportServer(
      NettyServerBuilder
          .forPort(port)
          .flowControlWindow(65 * 1024),
      streamTracerFactories,
      fakeClockTransportTracer);
}
项目:grpc-java    文件:OkHttpTransportTest.java   
@Override
protected ManagedClientTransport newClientTransport(InternalServer server) {
  int port = server.getPort();
  return clientFactory.newClientTransport(
      new InetSocketAddress("localhost", port),
      testAuthority(server),
      null /* agent */,
      null /* proxy */);
}
项目:grpc-java    文件:NettyTransportTest.java   
@Override
protected InternalServer newServer(List<ServerStreamTracer.Factory> streamTracerFactories) {
  return NettyServerBuilder
      .forPort(0)
      .flowControlWindow(65 * 1024)
      .setTransportTracerFactory(fakeClockTransportTracer)
      .buildTransportServer(streamTracerFactories);
}
项目:grpc-java    文件:NettyTransportTest.java   
@Override
protected InternalServer newServer(
    InternalServer server, List<ServerStreamTracer.Factory> streamTracerFactories) {
  int port = server.getPort();
  return NettyServerBuilder
      .forPort(port)
      .flowControlWindow(65 * 1024)
      .setTransportTracerFactory(fakeClockTransportTracer)
      .buildTransportServer(streamTracerFactories);
}
项目:grpc-java    文件:NettyTransportTest.java   
@Override
protected ManagedClientTransport newClientTransport(InternalServer server) {
  int port = server.getPort();
  return clientFactory.newClientTransport(
      new InetSocketAddress("localhost", port),
      testAuthority(server),
      null /* agent */,
      null /* proxy */);
}
项目:grpc-java    文件:AbstractTransportTest.java   
@Test
public void serverAlreadyListening() throws Exception {
  client = null;
  server.start(serverListener);
  InternalServer server2 = newServer(server, Arrays.asList(serverStreamTracerFactory));
  thrown.expect(IOException.class);
  server2.start(new MockServerListener());
}
项目:grpc-java    文件:OkHttpTransportTest.java   
@Override
protected String testAuthority(InternalServer server) {
  return "thebestauthority:" + server.getPort();
}
项目:grpc-java    文件:NettyTransportTest.java   
@Override
protected String testAuthority(InternalServer server) {
  return "localhost:" + server.getPort();
}
项目:grpc-java    文件:InProcessTransportTest.java   
@Override
protected InternalServer newServer(List<ServerStreamTracer.Factory> streamTracerFactories) {
  return new InProcessServer(TRANSPORT_NAME, GrpcUtil.TIMER_SERVICE, streamTracerFactories);
}
项目:grpc-java    文件:InProcessTransportTest.java   
@Override
protected InternalServer newServer(
    InternalServer server, List<ServerStreamTracer.Factory> streamTracerFactories) {
  return newServer(streamTracerFactories);
}
项目:grpc-java    文件:InProcessTransportTest.java   
@Override
protected String testAuthority(InternalServer server) {
  return AUTHORITY;
}
项目:grpc-java    文件:InProcessTransportTest.java   
@Override
protected ManagedClientTransport newClientTransport(InternalServer server) {
  return new InProcessTransport(TRANSPORT_NAME, testAuthority(server), USER_AGENT);
}
项目:grpc-java    文件:AbstractTransportTest.java   
/**
 * Returns a new server that when started will be able to be connected to from the client. Each
 * returned instance should be new and yet be accessible by new client transports.
 */
protected abstract InternalServer newServer(
    List<ServerStreamTracer.Factory> streamTracerFactories);
项目:grpc-java    文件:AbstractTransportTest.java   
/**
 * Builds a new server that is listening on the same location as the given server instance does.
 */
protected abstract InternalServer newServer(
    InternalServer server, List<ServerStreamTracer.Factory> streamTracerFactories);
项目:grpc-java    文件:AbstractTransportTest.java   
/**
 * Returns a new transport that when started will be able to connect to {@code server}.
 */
protected abstract ManagedClientTransport newClientTransport(InternalServer server);
项目:grpc-java    文件:AbstractTransportTest.java   
/**
 * Returns the authority string used by a client to connect to {@code server}.
 */
protected abstract String testAuthority(InternalServer server);