@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { channel = ctx.channel(); channels.add(channel); attempts = 0; ctx.fireChannelActive(); }
/** Issues an initial TLS handshake once connected when used in client-mode */ @Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { if (!startTls && engine.getUseClientMode()) { // Begin the initial handshake handshake(null); } ctx.fireChannelActive(); }
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { if (log.isDebugEnabled()) { log.debug("New server-side connection {}", ctx.channel()); } stub.onConnection(); ctx.fireChannelActive(); }
@Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { ctx.fireChannelActive(); request = new NettyHttpChannel<>( tcpStream, new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/")); request.keepAlive(true); handler .apply(request) .subscribe( new DefaultSubscriber<Void>() { @Override public void onSubscribe(final Subscription s) { if (request.checkHeader()) { writeFirst(ctx) .addListener( new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { s.request(Long.MAX_VALUE); } else { log.error( "Error processing initial headers. Closing the channel.", future.cause()); s.cancel(); if (ctx.channel().isOpen()) { ctx.channel().close(); } } } }); } else { s.request(Long.MAX_VALUE); } } @Override public void onError(Throwable t) { log.error("Error processing connection. Closing the channel.", t); if (ctx.channel().isOpen()) { ctx.channel().close(); } } @Override public void onComplete() { writeLast(ctx); } }); }
static void pingBeforeActivate( final AsyncCommand<?, ?, ?> cmd, final SettableFuture<Boolean> initializedFuture, final ChannelHandlerContext ctx, final List<ChannelHandler> handlers) throws Exception { cmd.handle( (o, throwable) -> { if (throwable == null) { initializedFuture.set(true); ctx.fireChannelActive(); } else { initializedFuture.setException(throwable); } return null; }); ctx.channel().writeAndFlush(cmd); }
/** Issues a SSL handshake once connected when used in client-mode */ @Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { if (!startTls && engine.getUseClientMode()) { // issue and handshake and add a listener to it which will fire an exception event if // an exception was thrown while doing the handshake handshake() .addListener( new GenericFutureListener<Future<Channel>>() { @Override public void operationComplete(Future<Channel> future) throws Exception { if (!future.isSuccess()) { logger.debug("Failed to complete handshake", future.cause()); ctx.close(); } } }); } ctx.fireChannelActive(); }
/** Calls {@link #handshake()} once the {@link Channel} is connected */ @Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { if (!startTls && engine.getUseClientMode()) { // issue and handshake and add a listener to it which will fire an exception event if // an exception was thrown while doing the handshake handshake() .addListener( new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { ctx.pipeline().fireExceptionCaught(future.cause()); ctx.close(); } } }); } ctx.fireChannelActive(); }
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { LOGGER.debug(logIdent(ctx, endpoint) + "Channel Active."); remoteHostname = ctx.channel().remoteAddress().toString(); ctx.fireChannelActive(); }
@Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { group.add(ctx.channel()); ctx.fireChannelActive(); }
@Override public void sendNextLayerActive() { context.fireChannelActive(); }