@Test public void failIfMaxConnectionIdleNegative() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("max connection idle must be positive"); builder.maxConnectionIdle(-1, TimeUnit.HOURS); }
public NettyServerBuilder maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit) { checkArgument(maxConnectionIdle > 0L, "max connection idle must be positive"); maxConnectionIdleInNanos = timeUnit.toNanos(maxConnectionIdle); if (maxConnectionIdleInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionIdleInNanos = MAX_CONNECTION_IDLE_NANOS_DISABLED; } if (maxConnectionIdleInNanos < MIN_MAX_CONNECTION_IDLE_NANO) { maxConnectionIdleInNanos = MIN_MAX_CONNECTION_IDLE_NANO; } return this; }
NettyServerBuilder extends AbstractServerImplBuilder<NettyServerBuilder> { public NettyServerBuilder maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit) { checkArgument(maxConnectionIdle > 0L, "max connection idle must be positive"); maxConnectionIdleInNanos = timeUnit.toNanos(maxConnectionIdle); if (maxConnectionIdleInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionIdleInNanos = MAX_CONNECTION_IDLE_NANOS_DISABLED; } if (maxConnectionIdleInNanos < MIN_MAX_CONNECTION_IDLE_NANO) { maxConnectionIdleInNanos = MIN_MAX_CONNECTION_IDLE_NANO; } return this; } }
NettyServerBuilder extends AbstractServerImplBuilder<NettyServerBuilder> { public NettyServerBuilder maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit) { checkArgument(maxConnectionIdle > 0L, "max connection idle must be positive"); maxConnectionIdleInNanos = timeUnit.toNanos(maxConnectionIdle); if (maxConnectionIdleInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionIdleInNanos = MAX_CONNECTION_IDLE_NANOS_DISABLED; } if (maxConnectionIdleInNanos < MIN_MAX_CONNECTION_IDLE_NANO) { maxConnectionIdleInNanos = MIN_MAX_CONNECTION_IDLE_NANO; } return this; } @CheckReturnValue private  NettyServerBuilder(int port); @CheckReturnValue private  NettyServerBuilder(SocketAddress address); }
NettyServerBuilder extends AbstractServerImplBuilder<NettyServerBuilder> { public NettyServerBuilder maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit) { checkArgument(maxConnectionIdle > 0L, "max connection idle must be positive"); maxConnectionIdleInNanos = timeUnit.toNanos(maxConnectionIdle); if (maxConnectionIdleInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionIdleInNanos = MAX_CONNECTION_IDLE_NANOS_DISABLED; } if (maxConnectionIdleInNanos < MIN_MAX_CONNECTION_IDLE_NANO) { maxConnectionIdleInNanos = MIN_MAX_CONNECTION_IDLE_NANO; } return this; } @CheckReturnValue private  NettyServerBuilder(int port); @CheckReturnValue private  NettyServerBuilder(SocketAddress address); @CheckReturnValue static NettyServerBuilder forPort(int port); @CheckReturnValue static NettyServerBuilder forAddress(SocketAddress address); NettyServerBuilder channelType(Class<? extends ServerChannel> channelType); NettyServerBuilder withChildOption(ChannelOption<T> option, T value); NettyServerBuilder bossEventLoopGroup(EventLoopGroup group); NettyServerBuilder workerEventLoopGroup(EventLoopGroup group); NettyServerBuilder sslContext(SslContext sslContext); @Internal final NettyServerBuilder protocolNegotiator(
          @Nullable ProtocolNegotiator protocolNegotiator); NettyServerBuilder maxConcurrentCallsPerConnection(int maxCalls); NettyServerBuilder flowControlWindow(int flowControlWindow); @Deprecated NettyServerBuilder maxMessageSize(int maxMessageSize); @Override NettyServerBuilder maxInboundMessageSize(int bytes); @Deprecated NettyServerBuilder maxHeaderListSize(int maxHeaderListSize); @Override NettyServerBuilder maxInboundMetadataSize(int bytes); NettyServerBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit); NettyServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit); NettyServerBuilder maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit); NettyServerBuilder maxConnectionAge(long maxConnectionAge, TimeUnit timeUnit); NettyServerBuilder maxConnectionAgeGrace(long maxConnectionAgeGrace, TimeUnit timeUnit); NettyServerBuilder permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit); NettyServerBuilder permitKeepAliveWithoutCalls(boolean permit); @Override NettyServerBuilder useTransportSecurity(File certChain, File privateKey); @Override NettyServerBuilder useTransportSecurity(InputStream certChain, InputStream privateKey); }
NettyServerBuilder extends AbstractServerImplBuilder<NettyServerBuilder> { public NettyServerBuilder maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit) { checkArgument(maxConnectionIdle > 0L, "max connection idle must be positive"); maxConnectionIdleInNanos = timeUnit.toNanos(maxConnectionIdle); if (maxConnectionIdleInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionIdleInNanos = MAX_CONNECTION_IDLE_NANOS_DISABLED; } if (maxConnectionIdleInNanos < MIN_MAX_CONNECTION_IDLE_NANO) { maxConnectionIdleInNanos = MIN_MAX_CONNECTION_IDLE_NANO; } return this; } @CheckReturnValue private  NettyServerBuilder(int port); @CheckReturnValue private  NettyServerBuilder(SocketAddress address); @CheckReturnValue static NettyServerBuilder forPort(int port); @CheckReturnValue static NettyServerBuilder forAddress(SocketAddress address); NettyServerBuilder channelType(Class<? extends ServerChannel> channelType); NettyServerBuilder withChildOption(ChannelOption<T> option, T value); NettyServerBuilder bossEventLoopGroup(EventLoopGroup group); NettyServerBuilder workerEventLoopGroup(EventLoopGroup group); NettyServerBuilder sslContext(SslContext sslContext); @Internal final NettyServerBuilder protocolNegotiator(
          @Nullable ProtocolNegotiator protocolNegotiator); NettyServerBuilder maxConcurrentCallsPerConnection(int maxCalls); NettyServerBuilder flowControlWindow(int flowControlWindow); @Deprecated NettyServerBuilder maxMessageSize(int maxMessageSize); @Override NettyServerBuilder maxInboundMessageSize(int bytes); @Deprecated NettyServerBuilder maxHeaderListSize(int maxHeaderListSize); @Override NettyServerBuilder maxInboundMetadataSize(int bytes); NettyServerBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit); NettyServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit); NettyServerBuilder maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit); NettyServerBuilder maxConnectionAge(long maxConnectionAge, TimeUnit timeUnit); NettyServerBuilder maxConnectionAgeGrace(long maxConnectionAgeGrace, TimeUnit timeUnit); NettyServerBuilder permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit); NettyServerBuilder permitKeepAliveWithoutCalls(boolean permit); @Override NettyServerBuilder useTransportSecurity(File certChain, File privateKey); @Override NettyServerBuilder useTransportSecurity(InputStream certChain, InputStream privateKey); static final int DEFAULT_FLOW_CONTROL_WINDOW; }