ServerBuilder { public ServerBuilder maxConnectionAgeMillis(long maxConnectionAgeMillis) { checkArgument(maxConnectionAgeMillis >= MIN_MAX_CONNECTION_AGE_MILLIS || maxConnectionAgeMillis == 0, "maxConnectionAgeMillis: %s (expected: >= %s or == 0)", maxConnectionAgeMillis, MIN_MAX_CONNECTION_AGE_MILLIS); this.maxConnectionAgeMillis = maxConnectionAgeMillis; return this; } ServerBuilder(); ServerBuilder http(int port); ServerBuilder http(InetSocketAddress localAddress); ServerBuilder https(int port); ServerBuilder https(InetSocketAddress localAddress); ServerBuilder port(int port, SessionProtocol... protocols); ServerBuilder port(int port, Iterable<SessionProtocol> protocols); ServerBuilder port(InetSocketAddress localAddress, SessionProtocol... protocols); ServerBuilder port(InetSocketAddress localAddress, Iterable<SessionProtocol> protocols); ServerBuilder port(ServerPort port); ServerBuilder channelOption(ChannelOption<T> option, T value); ServerBuilder childChannelOption(ChannelOption<T> option, T value); ServerBuilder workerGroup(EventLoopGroup workerGroup, boolean shutdownOnStop); ServerBuilder startStopExecutor(Executor startStopExecutor); ServerBuilder maxNumConnections(int maxNumConnections); ServerBuilder idleTimeoutMillis(long idleTimeoutMillis); ServerBuilder idleTimeout(Duration idleTimeout); ServerBuilder pingIntervalMillis(long pingIntervalMillis); ServerBuilder pingInterval(Duration pingInterval); ServerBuilder maxConnectionAgeMillis(long maxConnectionAgeMillis); ServerBuilder maxConnectionAge(Duration maxConnectionAge); ServerBuilder http2InitialConnectionWindowSize(int http2InitialConnectionWindowSize); ServerBuilder http2InitialStreamWindowSize(int http2InitialStreamWindowSize); ServerBuilder http2MaxStreamsPerConnection(long http2MaxStreamsPerConnection); ServerBuilder http2MaxFrameSize(int http2MaxFrameSize); ServerBuilder http2MaxHeaderListSize(long http2MaxHeaderListSize); ServerBuilder http1MaxInitialLineLength(int http1MaxInitialLineLength); ServerBuilder http1MaxHeaderSize(int http1MaxHeaderSize); ServerBuilder http1MaxChunkSize(int http1MaxChunkSize); ServerBuilder gracefulShutdownTimeoutMillis(long quietPeriodMillis, long timeoutMillis); ServerBuilder gracefulShutdownTimeout(Duration quietPeriod, Duration timeout); ServerBuilder blockingTaskExecutor(ScheduledExecutorService blockingTaskExecutor,
                                              boolean shutdownOnStop); ServerBuilder meterRegistry(MeterRegistry meterRegistry); ServerBuilder accessLogFormat(String accessLogFormat); ServerBuilder accessLogWriter(AccessLogWriter accessLogWriter, boolean shutdownOnStop); ServerBuilder proxyProtocolMaxTlvSize(int proxyProtocolMaxTlvSize); ServerBuilder tls(File keyCertChainFile, File keyFile); ServerBuilder tls(
            File keyCertChainFile, File keyFile, @Nullable String keyPassword); ServerBuilder tls(InputStream keyCertChainInputStream, InputStream keyInputStream); ServerBuilder tls(InputStream keyCertChainInputStream, InputStream keyInputStream,
                             @Nullable String keyPassword); ServerBuilder tls(PrivateKey key, X509Certificate... keyCertChain); ServerBuilder tls(PrivateKey key, Iterable<? extends X509Certificate> keyCertChain); ServerBuilder tls(PrivateKey key, @Nullable String keyPassword, X509Certificate... keyCertChain); ServerBuilder tls(PrivateKey key, @Nullable String keyPassword,
                             Iterable<? extends X509Certificate> keyCertChain); ServerBuilder tls(KeyManagerFactory keyManagerFactory); ServerBuilder tlsSelfSigned(); ServerBuilder tlsSelfSigned(boolean tlsSelfSigned); ServerBuilder tlsCustomizer(Consumer<? super SslContextBuilder> tlsCustomizer); ServerBuilder withRoute(Consumer<? super ServiceBindingBuilder> customizer); ServiceBindingBuilder route(); DecoratingServiceBindingBuilder routeDecorator(); ServerBuilder serviceUnder(String pathPrefix, HttpService service); ServerBuilder service(String pathPattern, HttpService service); ServerBuilder service(Route route, HttpService service); ServerBuilder service(
            HttpServiceWithRoutes serviceWithRoutes,
            Iterable<? extends Function<? super HttpService, ? extends HttpService>> decorators); @SafeVarargs final ServerBuilder service(
            HttpServiceWithRoutes serviceWithRoutes,
            Function<? super HttpService, ? extends HttpService>... decorators); ServerBuilder annotatedService(Object service); ServerBuilder annotatedService(Object service,
                                          Object... exceptionHandlersAndConverters); ServerBuilder annotatedService(Object service,
                                          Function<? super HttpService, ? extends HttpService> decorator,
                                          Object... exceptionHandlersAndConverters); ServerBuilder annotatedService(String pathPrefix, Object service); ServerBuilder annotatedService(String pathPrefix, Object service,
                                          Object... exceptionHandlersAndConverters); ServerBuilder annotatedService(String pathPrefix, Object service,
                                          Function<? super HttpService, ? extends HttpService> decorator,
                                          Object... exceptionHandlersAndConverters); ServerBuilder annotatedService(String pathPrefix, Object service,
                                          Iterable<?> exceptionHandlersAndConverters); ServerBuilder annotatedService(String pathPrefix, Object service,
                                          Function<? super HttpService, ? extends HttpService> decorator,
                                          Iterable<?> exceptionHandlersAndConverters); ServerBuilder annotatedService(
            String pathPrefix, Object service, Function<? super HttpService, ? extends HttpService> decorator,
            Iterable<? extends ExceptionHandlerFunction> exceptionHandlerFunctions,
            Iterable<? extends RequestConverterFunction> requestConverterFunctions,
            Iterable<? extends ResponseConverterFunction> responseConverterFunctions); AnnotatedServiceBindingBuilder annotatedService(); ServerBuilder serverListener(ServerListener serverListener); ServerBuilder defaultHostname(String defaultHostname); ServerBuilder withDefaultVirtualHost(Consumer<? super VirtualHostBuilder> customizer); VirtualHostBuilder defaultVirtualHost(); ServerBuilder withVirtualHost(Consumer<? super VirtualHostBuilder> customizer); VirtualHostBuilder virtualHost(String hostnamePattern); VirtualHostBuilder virtualHost(String defaultHostname, String hostnamePattern); ServerBuilder decorator(Function<? super HttpService, ? extends HttpService> decorator); ServerBuilder decorator(
            DecoratingHttpServiceFunction decoratingHttpServiceFunction); ServerBuilder decorator(
            String pathPattern, Function<? super HttpService, ? extends HttpService> decorator); ServerBuilder decorator(
            String pathPattern, DecoratingHttpServiceFunction decoratingHttpServiceFunction); ServerBuilder decorator(
            Route route, Function<? super HttpService, ? extends HttpService> decorator); ServerBuilder decorator(
            Route route, DecoratingHttpServiceFunction decoratingHttpServiceFunction); ServerBuilder decoratorUnder(
            String prefix, DecoratingHttpServiceFunction decoratingHttpServiceFunction); ServerBuilder decoratorUnder(String prefix,
                                        Function<? super HttpService, ? extends HttpService> decorator); ServerBuilder clientAddressSources(ClientAddressSource... clientAddressSources); ServerBuilder clientAddressSources(Iterable<ClientAddressSource> clientAddressSources); ServerBuilder clientAddressTrustedProxyFilter(
            Predicate<? super InetAddress> clientAddressTrustedProxyFilter); ServerBuilder clientAddressFilter(Predicate<? super InetAddress> clientAddressFilter); ServerBuilder clientAddressMapper(
            Function<? super ProxiedAddresses, ? extends InetSocketAddress> clientAddressMapper); ServerBuilder accessLogger(String loggerName); ServerBuilder accessLogger(Logger logger); ServerBuilder accessLogger(Function<? super VirtualHost, ? extends Logger> mapper); ServerBuilder rejectedRouteHandler(RejectedRouteHandler handler); ServerBuilder disableServerHeader(); ServerBuilder disableDateHeader(); ServerBuilder requestIdGenerator(Supplier<? extends RequestId> requestIdGenerator); ServerBuilder requestTimeout(Duration requestTimeout); ServerBuilder requestTimeoutMillis(long requestTimeoutMillis); ServerBuilder maxRequestLength(long maxRequestLength); ServerBuilder verboseResponses(boolean verboseResponses); ServerBuilder annotatedServiceExtensions(
            Iterable<? extends RequestConverterFunction> requestConverterFunctions,
            Iterable<? extends ResponseConverterFunction> responseConverterFunctions,
            Iterable<? extends ExceptionHandlerFunction> exceptionHandlerFunctions); Server build(); @Override String toString();  }
@Test void invalidMaxConnectionAge() { assertThatThrownBy(() -> Server.builder().maxConnectionAgeMillis(-1)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("expected: >= 1000 or == 0"); assertThatThrownBy(() -> Server.builder().maxConnectionAgeMillis(100)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("expected: >= 1000 or == 0"); }