Search in sources :

Example 1 with ServerListener

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();
}
Also used : ServerTransportListener(io.grpc.internal.ServerTransportListener) ServerTransport(io.grpc.internal.ServerTransport) InetSocketAddress(java.net.InetSocketAddress) ServerListener(io.grpc.internal.ServerListener) Test(org.junit.Test)

Aggregations

ServerListener (io.grpc.internal.ServerListener)1 ServerTransport (io.grpc.internal.ServerTransport)1 ServerTransportListener (io.grpc.internal.ServerTransportListener)1 InetSocketAddress (java.net.InetSocketAddress)1 Test (org.junit.Test)1