Guard connectPromise not being null
[netconf.git] / netconf / netconf-netty-util / src / main / java / org / opendaylight / netconf / nettyutil / handler / ssh / client / AsyncSshHandler.java
index f9598210a6ec0a4772d2796958eda212baf64a4f..213b4c13307ab0430d78733c804e8ff4fc15d4be 100644 (file)
@@ -191,8 +191,8 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
     @Override
     public synchronized void connect(final ChannelHandlerContext ctx, final SocketAddress remoteAddress,
                                      final SocketAddress localAddress, final ChannelPromise promise) throws Exception {
-        LOG.debug("SSH session connecting on channel {}. promise: {}", ctx.channel(), connectPromise);
-        connectPromise = promise;
+        LOG.debug("SSH session connecting on channel {}. promise: {}", ctx.channel(), promise);
+        connectPromise = requireNonNull(promise);
 
         if (negotiationFuture != null) {
             negotiationFutureListener = future -> {