use of io.grpc.internal.ServerListener in project grpc-java by grpc.
the class NettyServerTest method getPort.
@Test
public void getPort() throws Exception {
InetSocketAddress addr = new InetSocketAddress(0);
NettyServer ns = new NettyServer(addr, NioServerSocketChannel.class, // no boss group
null, // no event group
null, new ProtocolNegotiators.PlaintextNegotiator(), // ignore
1, // ignore
1, // ignore
1, // ignore
1);
ns.start(new ServerListener() {
@Override
public ServerTransportListener transportCreated(ServerTransport transport) {
return null;
}
@Override
public void serverShutdown() {
}
});
// Check that we got an actual port.
assertThat(ns.getPort()).isGreaterThan(0);
// Cleanup
ns.shutdown();
}
Aggregations