NetconfClientFactoryImpl should propagate stack failure
[netconf.git] / protocol / netconf-client / src / main / java / org / opendaylight / netconf / client / ClientTransportChannelListener.java
index 52d2cbf201255e4a8819d95bf88819a03617fe31..750567d7513a1b2c7554b289f87315250058a61b 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.netconf.client;
 
 import static java.util.Objects.requireNonNull;
 
+import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import io.netty.util.concurrent.Future;
@@ -16,10 +17,12 @@ import io.netty.util.concurrent.FutureListener;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.netconf.transport.api.TransportChannel;
 import org.opendaylight.netconf.transport.api.TransportChannelListener;
+import org.opendaylight.netconf.transport.api.TransportStack;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-final class ClientTransportChannelListener implements TransportChannelListener, FutureListener<NetconfClientSession> {
+final class ClientTransportChannelListener implements TransportChannelListener, FutureListener<NetconfClientSession>,
+        FutureCallback<TransportStack> {
     private static final Logger LOG = LoggerFactory.getLogger(ClientTransportChannelListener.class);
 
     private final @NonNull SettableFuture<NetconfClientSession> sessionFuture = SettableFuture.create();
@@ -56,4 +59,14 @@ final class ClientTransportChannelListener implements TransportChannelListener,
             sessionFuture.set(future.getNow());
         }
     }
+
+    @Override
+    public void onSuccess(final TransportStack result) {
+        // No-op
+    }
+
+    @Override
+    public void onFailure(final Throwable cause) {
+        onTransportChannelFailed(cause);
+    }
 }
\ No newline at end of file