Bug 1935 - Double fireConnectionReady notification
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / core / OFFrameDecoderTest.java
index 658b487d2eee75dff2fa4588a6624bebb80ea18b..23b29460049f74893511dbc5911e0935ed3fb44b 100644 (file)
@@ -47,7 +47,7 @@ public class OFFrameDecoderTest {
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        decoder = new OFFrameDecoder(connectionFacade);
+        decoder = new OFFrameDecoder(connectionFacade, false);
         list.clear();
 
     }
@@ -146,4 +146,22 @@ public class OFFrameDecoderTest {
     public void testExceptionCaught() throws Exception {
         decoder.exceptionCaught(channelHandlerContext, new Throwable());
     }
+
+    /**
+     * Test of decoding
+     * {@link OFFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}
+     */
+    @Test
+    public void testDecode8BMessageWithTls() {
+        decoder = new OFFrameDecoder(connectionFacade, true);
+        try {
+            decoder.decode(channelHandlerContext,
+                    ByteBufUtils.hexStringToByteBuf("04 00 00 08 00 00 00 01"),
+                    list);
+        } catch (Exception e) {
+            Assert.fail();
+        }
+
+        assertEquals(8, ((ByteBuf) list.get(0)).readableBytes());
+    }
 }