@Override protected ChannelFutureListener newCloseListener(SocketChannel ch, FabricConnection connection) { return closeHandlerFactory.getHandler(connection, super.newCloseListener(ch, connection)); }
@Override protected void initChannel(SocketChannel ch) throws Exception { connection = initRemoteConnection(ch); // each handler in the pipeline is created per connection ch.closeFuture().addListener(newCloseListener(ch, connection)); final ChannelPipeline pipe = ch.pipeline(); pipe.addLast(PROTOCOL_ENCODER, new RpcEncoder("c-" + rpcConfig.getName())); pipe.addLast(PROTOCOL_DECODER, newDecoder(connection.getAllocator())); pipe.addLast(HANDSHAKE_HANDLER, new ClientHandshakeHandler()); if (timeoutInMillis != -1) { pipe.addLast(IDLE_STATE_HANDLER, new IdlePingHandler(timeoutInMillis)); } pipe.addLast(MESSAGE_HANDLER, new InboundHandler(connection)); pipe.addLast(EXCEPTION_HANDLER, new RpcExceptionHandler<>(connection)); } });