BUG-2208: Cancel PCEPSessionNegotiator Timers on session down
[bgpcep.git] / pcep / impl / src / test / java / org / opendaylight / protocol / pcep / impl / AbstractPCEPSessionTest.java
index 8eac65ae0b35c85632ad3dc2432f1b0d38bf5c86..9b78a5b9abe5233e054219833dabb3d9f8d69078 100644 (file)
@@ -20,6 +20,7 @@ import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelPipeline;
 import io.netty.channel.DefaultChannelPromise;
 import io.netty.channel.EventLoop;
+import io.netty.util.concurrent.GenericFutureListener;
 import io.netty.util.concurrent.ScheduledFuture;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
@@ -50,6 +51,9 @@ public class AbstractPCEPSessionTest {
     @Mock
     protected Channel channel;
 
+    @Mock
+    private ChannelFuture channelFuture;
+
     @Mock
     private EventLoop eventLoop;
 
@@ -84,6 +88,8 @@ public class AbstractPCEPSessionTest {
                 return future;
             }
         }).when(this.channel).writeAndFlush(any(Notification.class));
+        doReturn(this.channelFuture).when(this.channel).closeFuture();
+        doReturn(this.channelFuture).when(this.channelFuture).addListener(any(GenericFutureListener.class));
         doReturn("TestingChannel").when(this.channel).toString();
         doReturn(this.pipeline).when(this.channel).pipeline();
         doReturn(this.address).when(this.channel).localAddress();