List of usage examples for io.netty.buffer PooledByteBufAllocator DEFAULT
PooledByteBufAllocator DEFAULT
To view the source code for io.netty.buffer PooledByteBufAllocator DEFAULT.
Click Source Link
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializerTest.java
License:Open Source License
/** * Test correct serialization/* w w w .ja va2s . c o m*/ */ @Test public void testSerializeWithoutMask() { MatchEntryBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); byte[] address = new byte[6]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[] { 0, 1, 2, 3, 4, 5 }, address); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializerTest.java
License:Open Source License
/** * Test correct serialization/*w w w. j a va2 s .c om*/ */ @Test public void testSerializeWithMask() { MatchEntryBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, true); byte[] address = new byte[6]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[] { 0, 1, 2, 3, 4, 10 }, address); byte[] tmp = new byte[6]; buffer.readBytes(tmp); Assert.assertArrayEquals("Wrong mask", new byte[] { 15, 15, 0, 0, 10, 10 }, tmp); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializerTest.java
License:Open Source License
/** * Test correct header serialization//from w w w . j a va2 s . c o m */ @Test public void testSerializeHeaderWithoutMask() { MatchEntryBuilder builder = prepareHeader(false); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serializeHeader(builder.build(), buffer); checkHeader(buffer, false); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializerTest.java
License:Open Source License
/** * Test correct header serialization// www. j av a 2 s.co m */ @Test public void testSerializeHeaderWithMask() { MatchEntryBuilder builder = prepareHeader(true); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serializeHeader(builder.build(), buffer); checkHeader(buffer, true); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializerTest.java
License:Open Source License
/** * Test correct serialization/*from www . j ava2 s. c om*/ */ @Test public void testSerializeWithoutMask() { MatchEntryBuilder builder = prepareMatchEntry(false, "10.0.0.1"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); byte[] address = new byte[4]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[] { 10, 0, 0, 1 }, address); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializerTest.java
License:Open Source License
/** * Test correct serialization//from www .j av a 2 s. c o m */ @Test public void testSerializeWithMask() { MatchEntryBuilder builder = prepareMatchEntry(true, "120.121.122.0"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, true); byte[] address = new byte[4]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[] { 120, 121, 122, 0 }, address); byte[] tmp = new byte[4]; buffer.readBytes(tmp); Assert.assertArrayEquals("Wrong mask", new byte[] { 15, 15, 0, 0 }, tmp); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializerTest.java
License:Open Source License
/** * Test correct serialization/* w ww . j ava2 s. c o m*/ */ @Test public void testSerialize() { MatchEntryBuilder builder = prepareEthTypeMatchEntry(65535); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); assertEquals("Wrong value", 65535, buffer.readUnsignedShort()); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializerTest.java
License:Open Source License
/** * Test correct header serialization/*w w w. ja va 2 s . co m*/ */ @Test public void testSerializeHeader() { MatchEntryBuilder builder = prepareEthTypeHeader(false); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serializeHeader(builder.build(), buffer); checkHeader(buffer, false); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializerTest.java
License:Open Source License
/** * Test correct serialization// ww w. ja v a 2 s.co m */ @Test public void testSerialize() { MatchEntryBuilder builder = prepareIcmpv4CodeMatchEntry((short) 200); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); assertEquals("Wrong value", 200, buffer.readUnsignedByte()); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializerTest.java
License:Open Source License
/** * Test correct header serialization/*from w w w. j a v a 2 s. co m*/ */ @Test public void testSerializeHeader() { MatchEntryBuilder builder = prepareIcmpv4CodeHeader(false); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serializeHeader(builder.build(), buffer); checkHeader(buffer, false); assertTrue("Unexpected data", buffer.readableBytes() == 0); }