Example usage for io.netty.buffer PooledByteBufAllocator DEFAULT

List of usage examples for io.netty.buffer PooledByteBufAllocator DEFAULT

Introduction

In this page you can find the example usage for io.netty.buffer PooledByteBufAllocator DEFAULT.

Prototype

PooledByteBufAllocator DEFAULT

To view the source code for io.netty.buffer PooledByteBufAllocator DEFAULT.

Click Source Link

Usage

From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializerTest.java

License:Open Source License

/**
 * Test correct header serialization/*from w w  w .  j a v  a  2 s.  c  o  m*/
 */
@Test
public void testSerializeHeader() {
    MatchEntryBuilder builder = prepareMplsBosHeader(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.OxmMplsLabelSerializerTest.java

License:Open Source License

/**
 * Test correct serialization/* w  w  w  . ja va2  s. c  o m*/
 */
@Test
public void testSerialize() {
    MatchEntryBuilder builder = prepareMplsLabelMatchEntry(168535);

    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(builder.build(), buffer);

    checkHeader(buffer, false);
    assertEquals("Wrong value", 168535, buffer.readUnsignedInt());
    assertTrue("Unexpected data", buffer.readableBytes() == 0);
}

From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsLabelSerializerTest.java

License:Open Source License

/**
 * Test correct header serialization//from w  ww  .j a v  a 2s.  com
 */
@Test
public void testSerializeHeader() {
    MatchEntryBuilder builder = prepareMplsLabelHeader(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.OxmMplsTcSerializerTest.java

License:Open Source License

/**
 * Test correct serialization//ww  w .j a  va2  s  .  c om
 */
@Test
public void testSerialize() {
    MatchEntryBuilder builder = prepareMplsTcMatchEntry((short) 16);

    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(builder.build(), buffer);

    checkHeader(buffer, false);
    assertEquals("Wrong value", 16, buffer.readUnsignedByte());
    assertTrue("Unexpected data", buffer.readableBytes() == 0);
}

From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsTcSerializerTest.java

License:Open Source License

/**
 * Test correct header serialization// w  w w  . j a  va  2  s . c o  m
 */
@Test
public void testSerializeHeader() {
    MatchEntryBuilder builder = prepareMplsTcHeader(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.OxmPbbIsidSerializerTest.java

License:Open Source License

/**
 * Test correct serialization//www  .java  2 s. c o m
 */
@Test
public void testSerializeWithMask() {
    MatchEntryBuilder builder = preparePbbIsidMatchEntry(false, 12345);

    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(builder.build(), buffer);

    checkHeader(buffer, false);
    assertEquals("Wrong value", 12345, buffer.readUnsignedMedium());
    assertTrue("Unexpected data", buffer.readableBytes() == 0);
}

From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializerTest.java

License:Open Source License

/**
 * Test correct serialization/*from   w ww. j  a v  a 2s .c  o  m*/
 */
@Test
public void testSerializeWithoutMask() {
    MatchEntryBuilder builder = preparePbbIsidMatchEntry(true, 6789);

    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(builder.build(), buffer);

    checkHeader(buffer, true);
    assertEquals("Wrong value", 6789, buffer.readUnsignedMedium());
    byte[] tmp = new byte[3];
    buffer.readBytes(tmp);
    Assert.assertArrayEquals("Wrong mask", new byte[] { 0, 15, 10 }, tmp);
    assertTrue("Unexpected data", buffer.readableBytes() == 0);
}

From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializerTest.java

License:Open Source License

/**
 * Test correct header serialization/*w ww. j  a v a 2s  .com*/
 */
@Test
public void testSerializeHeaderWithoutMask() {
    MatchEntryBuilder builder = preparePbbIsidHeader(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.OxmPbbIsidSerializerTest.java

License:Open Source License

/**
 * Test correct header serialization//  w w  w  .  j  a  va 2  s . co m
 */
@Test
public void testSerializeHeaderWithMask() {
    MatchEntryBuilder builder = preparePbbIsidHeader(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.OxmSctpDstSerializerTest.java

License:Open Source License

/**
 * Test correct serialization/*from   ww  w  . j a va 2  s. c  o  m*/
 */
@Test
public void testSerialize() {
    MatchEntryBuilder builder = prepareMatchEntry(4096);

    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(builder.build(), buffer);

    checkHeader(buffer, false);
    assertEquals("Wrong value", 4096, buffer.readUnsignedShort());
    assertTrue("Unexpected data", buffer.readableBytes() == 0);
}