private synchronized void handleSshChanelOpened(final ChannelHandlerContext ctx) { LOG.trace("SSH subsystem channel opened successfully on channel: {}", ctx.channel()); connectPromise.setSuccess(); // TODO we should also read from error stream and at least log from that sshReadAsyncListener = new AsyncSshHandlerReader(new AutoCloseable() { @Override public void close() throws Exception { AsyncSshHandler.this.disconnect(ctx, ctx.newPromise()); } }, new AsyncSshHandlerReader.ReadMsgHandler() { @Override public void onMessageRead(final ByteBuf msg) { ctx.fireChannelRead(msg); } }, channel.toString(), channel.getAsyncOut()); // if readAsyncListener receives immediate close, it will close this handler and closing this handler sets channel variable to null if(channel != null) { sshWriteAsyncHandler = new AsyncSshHandlerWriter(channel.getAsyncIn()); ctx.fireChannelActive(); } }
private synchronized void handleSshChanelOpened(final ChannelHandlerContext ctx) { LOG.trace("SSH subsystem channel opened successfully on channel: {}", ctx.channel()); if(negotiationFuture == null) { connectPromise.setSuccess(); } // TODO we should also read from error stream and at least log from that sshReadAsyncListener = new AsyncSshHandlerReader(new AutoCloseable() { @Override public void close() throws Exception { AsyncSshHandler.this.disconnect(ctx, ctx.newPromise()); } }, new AsyncSshHandlerReader.ReadMsgHandler() { @Override public void onMessageRead(final ByteBuf msg) { ctx.fireChannelRead(msg); } }, channel.toString(), channel.getAsyncOut()); // if readAsyncListener receives immediate close, it will close this handler and closing this handler sets channel variable to null if(channel != null) { sshWriteAsyncHandler = new AsyncSshHandlerWriter(channel.getAsyncIn()); ctx.fireChannelActive(); } }