Java Code Examples for io.grpc.inprocess.InProcessChannelBuilder#build()

The following examples show how to use io.grpc.inprocess.InProcessChannelBuilder#build() . 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: GrpcServerRule.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
/**
 * Before the test has started, create the server and channel.
 */
@Override
protected void before() throws Throwable {
  serverName = UUID.randomUUID().toString();

  serviceRegistry = new MutableHandlerRegistry();

  InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(serverName)
      .fallbackHandlerRegistry(serviceRegistry);

  if (useDirectExecutor) {
    serverBuilder.directExecutor();
  }

  server = serverBuilder.build().start();

  InProcessChannelBuilder channelBuilder = InProcessChannelBuilder.forName(serverName);

  if (useDirectExecutor) {
    channelBuilder.directExecutor();
  }

  channel = channelBuilder.build();
}
 
Example 2
Source File: GrpcServerExtension.java    From jetcd with Apache License 2.0 6 votes vote down vote up
/**
 * Before the test has started, create the server and channel.
 */
@Override
public void beforeEach(ExtensionContext context) throws Exception {
    serverName = UUID.randomUUID().toString();

    serviceRegistry = new MutableHandlerRegistry();

    InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(serverName)
        .fallbackHandlerRegistry(serviceRegistry);

    if (useDirectExecutor) {
        serverBuilder.directExecutor();
    }

    server = serverBuilder.build().start();

    InProcessChannelBuilder channelBuilder = InProcessChannelBuilder.forName(serverName);

    if (useDirectExecutor) {
        channelBuilder.directExecutor();
    }

    channel = channelBuilder.build();
}
 
Example 3
Source File: GrpcServerRule.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
/**
 * Before the test has started, create the server and channel.
 */
@Override
protected void before() throws Throwable {
  serverName = UUID.randomUUID().toString();

  serviceRegistry = new MutableHandlerRegistry();

  InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(serverName)
      .fallbackHandlerRegistry(serviceRegistry);

  if (useDirectExecutor) {
    serverBuilder.directExecutor();
  }

  server = serverBuilder.build().start();

  InProcessChannelBuilder channelBuilder = InProcessChannelBuilder.forName(serverName);

  if (useDirectExecutor) {
    channelBuilder.directExecutor();
  }

  channel = channelBuilder.build();
}
 
Example 4
Source File: InProcessTest.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Override
protected ManagedChannel createChannel() {
  InProcessChannelBuilder builder = InProcessChannelBuilder.forName(SERVER_NAME);
  io.grpc.internal.TestingAccessor.setStatsImplementation(
      builder, createClientCensusStatsModule());
  return builder.build();
}