Search in sources :

Example 26 with ReadTimeoutHandler

use of io.netty.handler.timeout.ReadTimeoutHandler in project reactor-netty by reactor.

the class Application method main.

public static void main(String[] args) {
    DisposableServer server = HttpServer.create().doOnConnection(conn -> conn.addHandler(new ReadTimeoutHandler(10, TimeUnit.SECONDS))).doOnChannelInit((observer, channel, remoteAddress) -> channel.pipeline().addFirst(// <2>
    new LoggingHandler("reactor.netty.examples"))).bindNow();
    server.onDispose().block();
}
Also used : TimeUnit(java.util.concurrent.TimeUnit) HttpServer(reactor.netty.http.server.HttpServer) LoggingHandler(io.netty.handler.logging.LoggingHandler) ReadTimeoutHandler(io.netty.handler.timeout.ReadTimeoutHandler) DisposableServer(reactor.netty.DisposableServer) LoggingHandler(io.netty.handler.logging.LoggingHandler) DisposableServer(reactor.netty.DisposableServer) ReadTimeoutHandler(io.netty.handler.timeout.ReadTimeoutHandler)

Aggregations

ReadTimeoutHandler (io.netty.handler.timeout.ReadTimeoutHandler)26 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)7 ChannelHandler (io.netty.channel.ChannelHandler)6 ChannelPipeline (io.netty.channel.ChannelPipeline)6 LoggingHandler (io.netty.handler.logging.LoggingHandler)6 TimeUnit (java.util.concurrent.TimeUnit)6 Bootstrap (io.netty.bootstrap.Bootstrap)5 SocketChannel (io.netty.channel.socket.SocketChannel)5 Channel (io.netty.channel.Channel)4 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)4 HttpObjectAggregator (io.netty.handler.codec.http.HttpObjectAggregator)4 IOException (java.io.IOException)4 InetSocketAddress (java.net.InetSocketAddress)4 AtomicReference (java.util.concurrent.atomic.AtomicReference)4 Connection (reactor.netty.Connection)4 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)3 ByteBuf (io.netty.buffer.ByteBuf)3 LengthFieldBasedFrameDecoder (io.netty.handler.codec.LengthFieldBasedFrameDecoder)3 SslContext (io.netty.handler.ssl.SslContext)3 SSLException (javax.net.ssl.SSLException)3