@Test public void testManyPortsButTwoTheSame() throws Exception { int samePort = 9999; WebServer webServer = WebServer.builder() .port(samePort) .addSocket(SocketConfiguration.create("1")) .addSocket(SocketConfiguration.builder() .name("2") .port(samePort)) .addSocket(SocketConfiguration.create("3")) .addSocket(SocketConfiguration.create("4")) .addSocket(SocketConfiguration.create("5")) .addSocket(SocketConfiguration.create("6")) .build(); assertStartFailure(webServer); }
@Override public int port(String name) { Channel channel = channels.get(name); if (channel == null) { return -1; } SocketAddress address = channel.localAddress(); return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getPort() : -1; }
NettyWebServer implements WebServer { @Override public int port(String name) { Channel channel = channels.get(name); if (channel == null) { return -1; } SocketAddress address = channel.localAddress(); return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getPort() : -1; } }
NettyWebServer implements WebServer { @Override public int port(String name) { Channel channel = channels.get(name); if (channel == null) { return -1; } SocketAddress address = channel.localAddress(); return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getPort() : -1; } NettyWebServer(ServerConfiguration config,
                   Routing routing,
                   Map<String, Routing> namedRoutings,
                   MessageBodyWriterContext writerContext,
                   MessageBodyReaderContext readerContext); }
NettyWebServer implements WebServer { @Override public int port(String name) { Channel channel = channels.get(name); if (channel == null) { return -1; } SocketAddress address = channel.localAddress(); return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getPort() : -1; } NettyWebServer(ServerConfiguration config,
                   Routing routing,
                   Map<String, Routing> namedRoutings,
                   MessageBodyWriterContext writerContext,
                   MessageBodyReaderContext readerContext); @Override ServerConfiguration configuration(); @Override MessageBodyReaderContext readerContext(); @Override MessageBodyWriterContext writerContext(); @Override synchronized Single<WebServer> start(); @Override Single<WebServer> shutdown(); @Override Single<WebServer> whenShutdown(); @Override boolean isRunning(); @Override Context context(); @Override int port(String name); }
NettyWebServer implements WebServer { @Override public int port(String name) { Channel channel = channels.get(name); if (channel == null) { return -1; } SocketAddress address = channel.localAddress(); return address instanceof InetSocketAddress ? ((InetSocketAddress) address).getPort() : -1; } NettyWebServer(ServerConfiguration config,
                   Routing routing,
                   Map<String, Routing> namedRoutings,
                   MessageBodyWriterContext writerContext,
                   MessageBodyReaderContext readerContext); @Override ServerConfiguration configuration(); @Override MessageBodyReaderContext readerContext(); @Override MessageBodyWriterContext writerContext(); @Override synchronized Single<WebServer> start(); @Override Single<WebServer> shutdown(); @Override Single<WebServer> whenShutdown(); @Override boolean isRunning(); @Override Context context(); @Override int port(String name);  }