use of io.grpc.inprocess.InProcessChannelBuilder in project grpc-java by grpc.
the class GrpcServerRule method before.
/**
* 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();
}
use of io.grpc.inprocess.InProcessChannelBuilder in project grpc-java by grpc.
the class HelloWorldClientTest method setUp.
/**
* Creates and starts a fake in-process server, and creates a client with an in-process channel.
*/
@Before
public void setUp() throws Exception {
String uniqueServerName = "fake server for " + getClass();
fakeServer = InProcessServerBuilder.forName(uniqueServerName).directExecutor().addService(serviceImpl).build().start();
InProcessChannelBuilder channelBuilder = InProcessChannelBuilder.forName(uniqueServerName).directExecutor();
client = new HelloWorldClient(channelBuilder);
}
Aggregations