Example usage for io.netty.buffer Unpooled buffer

List of usage examples for io.netty.buffer Unpooled buffer

Introduction

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

Prototype

public static ByteBuf buffer() 

Source Link

Document

Creates a new big-endian Java heap buffer with reasonably small initial capacity, which expands its capacity boundlessly on demand.

Usage

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf DecryptionErrorReportPeriodTester() {

    ODLCapwapMessage msg = null;//from  w  w  w  . j a v a  2  s .c  om

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    DecryptionErrorPeriod period = new DecryptionErrorPeriod();
    period.setRadioId((short) 12).setReportInterval(36);
    msg.ctrlMsg.addMessageElement(period);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);
    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf DuplicateIPV4Tester() {

    ODLCapwapMessage msg = null;//from w ww.ja va  2  s. co m

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    DuplicateIPV4Addr duplicateIPV4Addr = new DuplicateIPV4Addr();
    //set IPV4 Adddress
    IPV4Address ipv4 = new IPV4Address();
    byte[] address = new byte[] { 1, 2, 3, 4 };
    ipv4.setAddress(address);

    //set
    MacAddress mac = new MacAddress((short) 8);
    mac.address[0] = 12;
    mac.address[1] = 15;
    mac.address[2] = 12;
    mac.address[3] = 17;
    mac.address[4] = 12;
    mac.address[7] = 12;
    duplicateIPV4Addr.setIpv4(ipv4).setMacAddress(mac).setStatus((short) 1);
    msg.ctrlMsg.addMessageElement(duplicateIPV4Addr);
    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf IdleTimeOutTester() {

    ODLCapwapMessage msg = null;/*ww w  .  j  a v  a  2s. c  o  m*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    IdleTimeOut timeOut = new IdleTimeOut();
    timeOut.setTimout(12345);

    msg.ctrlMsg.addMessageElement(timeOut);
    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf EcnTester() {

    ODLCapwapMessage msg = null;/*  w w w. jav a 2 s  . co m*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    ECNSupport ecn = new ECNSupport();
    ecn.setEcn((byte) 1);
    msg.ctrlMsg.addMessageElement(ecn);
    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf imageDataTester() {

    ODLCapwapMessage msg = null;/* w  ww . j a  v a  2s. c o  m*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    ImageData img = new ImageData();
    byte[] dummy = new byte[1024];
    img.setData(dummy);
    img.setDataType((byte) 5);
    msg.ctrlMsg.addMessageElement(img);
    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf imageInfoTester() {

    ODLCapwapMessage msg = null;/*from  w  ww . ja v a2  s.c  om*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    ImageInformation id = new ImageInformation();
    byte[] dummy = new byte[16];
    id.setFileSize(12345);
    byte[] address = new byte[] { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
    id.setHash(address);
    msg.ctrlMsg.addMessageElement(id);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);
    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf initiateDownloadTester() {

    ODLCapwapMessage msg = null;//from  w  w  w  . j  a v  a  2 s  . c om

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    InitiateDownload in = new InitiateDownload();
    msg.ctrlMsg.addMessageElement(in);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);
    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf locationDataTester() {

    ODLCapwapMessage msg = null;/*from  w w  w.j a  v a2 s. c  o  m*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    LocationData l = new LocationData();
    byte[] address = new byte[] { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
    l.setLocationData(address);

    msg.ctrlMsg.addMessageElement(l);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);
    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf radioAdminStateTester() {

    ODLCapwapMessage msg = null;/*  w  w w  .  j  a  v  a  2s .com*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    RadioAdministrativeState l = new RadioAdministrativeState();
    l.setRadioId((short) 1);
    l.setAdminState((short) 2);

    msg.ctrlMsg.addMessageElement(l);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf radioOperationalStateTester() {

    ODLCapwapMessage msg = null;/*from  ww w  .  ja v a2s.  c  o  m*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    RadioOperationalState l = new RadioOperationalState();
    l.setRadioId((short) 1);
    l.setCause((short) 7);
    l.setState((short) 5);

    msg.ctrlMsg.addMessageElement(l);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);
    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}