use of org.apache.flink.shaded.netty4.io.netty.handler.timeout.IdleStateHandler in project netty by netty.
the class UptimeClient method main.
public static void main(String[] args) throws Exception {
EventLoopGroup group = new NioEventLoopGroup();
bs.group(group).channel(NioSocketChannel.class).remoteAddress(HOST, PORT).handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(new IdleStateHandler(READ_TIMEOUT, 0, 0), handler);
}
});
bs.connect();
}
use of org.apache.flink.shaded.netty4.io.netty.handler.timeout.IdleStateHandler in project netty by netty.
the class MqttHeartBeatClient method main.
public static void main(String[] args) throws Exception {
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
Bootstrap b = new Bootstrap();
b.group(workerGroup);
b.channel(NioSocketChannel.class);
b.handler(new ChannelInitializer<SocketChannel>() {
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast("encoder", MqttEncoder.INSTANCE);
ch.pipeline().addLast("decoder", new MqttDecoder());
ch.pipeline().addLast("heartBeatHandler", new IdleStateHandler(0, 20, 0, TimeUnit.SECONDS));
ch.pipeline().addLast("handler", new MqttHeartBeatClientHandler(CLIENT_ID, USER_NAME, PASSWORD));
}
});
ChannelFuture f = b.connect(HOST, PORT).sync();
System.out.println("Client connected");
f.channel().closeFuture().sync();
} finally {
workerGroup.shutdownGracefully();
}
}
use of org.apache.flink.shaded.netty4.io.netty.handler.timeout.IdleStateHandler in project LogHub by fbacchella.
the class Beats method addHandlers.
@Override
public void addHandlers(ChannelPipeline pipe) {
super.addHandlers(pipe);
// From org.logstash.beats.Server
// We have set a specific executor for the idle check, because the `beatsHandler` can be
// blocked on the queue, this the idleStateHandler manage the `KeepAlive` signal.
pipe.addBefore(idleExecutorGroup, "Splitter", "KeepAlive", new IdleStateHandler(clientInactivityTimeoutSeconds, 5, 0));
pipe.addAfter("Splitter", "Acker", new AckEncoder());
pipe.addAfter("Acker", "Handler", new BeatsHandler(messageListener));
}
use of org.apache.flink.shaded.netty4.io.netty.handler.timeout.IdleStateHandler in project zuul by Netflix.
the class BaseZuulChannelInitializer method addTimeoutHandlers.
protected void addTimeoutHandlers(ChannelPipeline pipeline) {
pipeline.addLast(new IdleStateHandler(0, 0, idleTimeout, TimeUnit.MILLISECONDS));
pipeline.addLast(new CloseOnIdleStateHandler(registry, metricId));
}
use of org.apache.flink.shaded.netty4.io.netty.handler.timeout.IdleStateHandler in project zuul by Netflix.
the class DefaultClientChannelManager method releaseHandlers.
protected void releaseHandlers(PooledConnection conn) {
final ChannelPipeline pipeline = conn.getChannel().pipeline();
removeHandlerFromPipeline(OriginResponseReceiver.CHANNEL_HANDLER_NAME, pipeline);
// The Outbound handler is always after the inbound handler, so look for it.
ChannelHandlerContext passportStateHttpClientHandlerCtx = pipeline.context(PassportStateHttpClientHandler.OutboundHandler.class);
pipeline.addAfter(passportStateHttpClientHandlerCtx.name(), IDLE_STATE_HANDLER_NAME, new IdleStateHandler(0, 0, connPoolConfig.getIdleTimeout(), TimeUnit.MILLISECONDS));
}
Aggregations