本文整理汇总了Java中org.jboss.netty.buffer.ChannelBuffer.writeBytes方法的典型用法代码示例。如果您正苦于以下问题:Java ChannelBuffer.writeBytes方法的具体用法?Java ChannelBuffer.writeBytes怎么用?Java ChannelBuffer.writeBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.netty.buffer.ChannelBuffer
的用法示例。
在下文中一共展示了ChannelBuffer.writeBytes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bgpUpdateMessageTest06
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* In this test case, Invalid withdrawn route length is given as input and expecting
* an exception.
*/
@Test(expected = BgpParseException.class)
public void bgpUpdateMessageTest06() throws BgpParseException {
byte[] updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, 0x00, 0x1b, 0x02, 0x00, 0x04, 0x19, 0x0a, 0x01, 0x01, 0x00, 0x00};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(updateMsg);
BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
BgpMessage message;
BgpHeader bgpHeader = new BgpHeader();
message = reader.readFrom(buffer, bgpHeader);
assertThat(message, instanceOf(BgpUpdateMsg.class));
}
示例2: pcepUpdateMsgTest11
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA
* bandwidth object in PcepUpdate message.
*/
@Test
public void pcepUpdateMsgTest11() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x01, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testupdateMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(updateMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
assertThat(message, instanceOf(PcepUpdateMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
int readLen = buf.writerIndex() - 0;
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
assertThat(testupdateMsg, is(updateMsg));
}
示例3: pcepUpdateMsgTest14
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA
* metric object in PcepUpdate message.
*/
@Test
public void pcepUpdateMsgTest14() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x01, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
byte[] testupdateMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(updateMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
assertThat(message, instanceOf(PcepUpdateMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
int readLen = buf.writerIndex() - 0;
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
assertThat(testupdateMsg, is(updateMsg));
}
示例4: write
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
@Override
public int write(ChannelBuffer cb) {
int iLenStartIndex = cb.writerIndex();
cb.writeByte(FLOW_SPEC_TYPE);
for (BgpFsOperatorValue fsOperVal : operatorValue) {
cb.writeByte(fsOperVal.option());
cb.writeBytes(fsOperVal.value());
}
return cb.writerIndex() - iLenStartIndex;
}
示例5: errorMessageTest19
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case checks for
* PCEP-ERROR Object, PCEP-ERROR Object, LS Object, LS Object, PCEP-ERROR Object, PCEP-ERROR Object
* in PcepErrorMsg message.
*/
@Test
public void errorMessageTest19() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x44, // common header
0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
0x00, 0x00, 0x01, 0x01,
0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
0x00, 0x00, 0x01, 0x03,
(byte) 0xE0, 0x10, 0x00, 0x10, // LS Object Header
0x01, 0x00, 0x00, 0x03, // LS-ID
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
(byte) 0xE0, 0x10, 0x00, 0x10, // LS Object Header
0x01, 0x00, 0x00, 0x03, // LS-ID
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x11,
0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
0x00, 0x00, 0x01, 0x04, // PCERR Object Header
0x0D, 0x10, 0x00, 0x08,
0x00, 0x00, 0x01, 0x06};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(errorMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testErrorMsg = {0};
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
assertThat(message, instanceOf(PcepErrorMsg.class));
message.writeTo(buf);
int iReadLen = buf.writerIndex();
testErrorMsg = new byte[iReadLen];
buf.readBytes(testErrorMsg, 0, iReadLen);
assertThat(testErrorMsg, is(errorMsg));
}
示例6: handle
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
@Override
public void handle(Channel channel, Token<DelegationTokenIdentifier> token,
String serviceUrl) throws IOException {
Assert.assertEquals(testToken, token);
byte[] bytes = EXP_DATE.getBytes();
ChannelBuffer cbuffer = ChannelBuffers.buffer(bytes.length);
cbuffer.writeBytes(bytes);
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
response.setHeader(HttpHeaders.Names.CONTENT_LENGTH,
String.valueOf(bytes.length));
response.setContent(cbuffer);
channel.write(response).addListener(ChannelFutureListener.CLOSE);
}
示例7: errorMessageTest5
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case checks for
* PCEP-ERROR Object, PCEP-ERROR Object, OPEN Object (STATEFUL-PCE-CAPABILITY)
* in PcepErrorMsg message.
*/
@Test
public void errorMessageTest5() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x24, // common header
0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCERR Object Header
0x00, 0x00, 0x01, 0x03, 0x01, 0x10, 0x00, 0x10, // OPEN object header
0x20, 0x05, 0x1E, 0x01, // OPEN object
0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY
0x00, 0x00, 0x00, 0x05};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(errorMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testErrorMsg = {0};
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
assertThat(message, instanceOf(PcepErrorMsg.class));
message.writeTo(buf);
int iReadLen = buf.writerIndex();
testErrorMsg = new byte[iReadLen];
buf.readBytes(testErrorMsg, 0, iReadLen);
assertThat(testErrorMsg, is(errorMsg));
}
示例8: lsReportMessageTest8
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case checks for LS Object (Routing Universe TLV,Local Node Descriptors TLV)
* in PcLSRpt message.
*/
@Test
public void lsReportMessageTest8() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] lsReportMsg = new byte[]{0x20, (byte) 0xE0, 0x00, 0x24, // common header
(byte) 0xE0, 0x10, 0x00, 0x20, // LS Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, // LS-ID
(byte) 0xFF, 0x01, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
(byte) 0xFF, 0x02, 0x00, 0x00 // Local Node Descriptors TLV
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(lsReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
assertThat(message, instanceOf(PcepLSReportMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex();
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
assertThat(testReportMsg, is(lsReportMsg));
}
示例9: write
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
@Override
public int write(ChannelBuffer c) {
int iLenStartIndex = c.writerIndex();
c.writeShort(TYPE);
c.writeShort(LENGTH);
c.writeBytes(rawValue);
return c.writerIndex() - iLenStartIndex;
}
示例10: bgpUpdateMessageTest17
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* In this test case, Invalid res is given as input and expecting
* an exception.
*/
@Test(expected = BgpParseException.class)
public void bgpUpdateMessageTest17() throws BgpParseException {
byte[] updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, 0x00, 0x60, 0x02, 0x00, 0x00, //withdrawn len
0x00, 0x49, //path attribute len
(byte) 0xff, 0x01, 0x01, 0x00, //origin
0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
(byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
(byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
0x01, //reserved
0x00, 0x01, 0x00,
0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00,
0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; //node nlri};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(updateMsg);
BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
BgpMessage message;
BgpHeader bgpHeader = new BgpHeader();
message = reader.readFrom(buffer, bgpHeader);
assertThat(message, instanceOf(BgpUpdateMsg.class));
}
示例11: initiateMessageTest31
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case checks for SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT
* objects in PcInitiate message.
*/
@Test
public void initiateMessageTest31() throws PcepParseException, PcepOutOfBoundMessageException {
// SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
//
byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(initiateCreationMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
assertThat(message, instanceOf(PcepInitiateMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testInitiateCreationMsg = buf.array();
int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
示例12: pcepUpdateMsgTest21
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case is for SRP object, LSP object, ERO object,
* Bandwidth , metric object in PcepUpdate message.
*/
@Test
public void pcepUpdateMsgTest21() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object
0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x01, 0x04, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
byte[] testupdateMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(updateMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
assertThat(message, instanceOf(PcepUpdateMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testupdateMsg = buf.array();
int readLen = buf.writerIndex() - 0;
testupdateMsg = new byte[readLen];
buf.readBytes(testupdateMsg, 0, readLen);
assertThat(testupdateMsg, is(updateMsg));
}
示例13: lsReportMessageTest7
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case checks for LS Object (Routing Universe TLV,Local Node Descriptors TLV(IgpRouterIdSubTlv)).
* in PcLSRpt message.
*/
@Test
public void lsReportMessageTest7() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] lsReportMsg = new byte[]{0x20, (byte) 0xE0, 0x00, 0x30, // common header
(byte) 0xE0, 0x10, 0x00, 0x2C, // LS Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, // LS-ID
(byte) 0xFF, 0x01, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
(byte) 0xFF, 0x02, 0x00, 0x0C, // Local Node Descriptors TLV
0x00, 0x04, 0x00, 0x08, //IgpRouterIdSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(lsReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
assertThat(message, instanceOf(PcepLSReportMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex();
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
assertThat(testReportMsg, is(lsReportMsg));
}
示例14: encodeContent
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
private ChannelBuffer encodeContent(String content) {
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
buf.writeByte(0x78);
buf.writeByte(0x78);
buf.writeByte(1 + 1 + 4 + content.length() + 2 + 2); // message length
buf.writeByte(0x80); // message type
buf.writeByte(4 + content.length()); // command length
buf.writeInt(0);
buf.writeBytes(content.getBytes(StandardCharsets.US_ASCII)); // command
buf.writeShort(0); // message index
buf.writeShort(Checksum.crc16(Checksum.CRC16_X25, buf.toByteBuffer(2, buf.writerIndex() - 2)));
buf.writeByte('\r');
buf.writeByte('\n');
return buf;
}
示例15: initiateMessageTest33
import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
* This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
* ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message.
*/
@Test
public void initiateMessageTest33() throws PcepParseException, PcepOutOfBoundMessageException {
// SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
// ERO, LSPA, BANDWIDTH OBJECT.
//
byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
0x07, 0x10, 0x00, 0x04, //ERO object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
byte[] testInitiateCreationMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(initiateCreationMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
assertThat(message, instanceOf(PcepInitiateMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testInitiateCreationMsg = buf.array();
int iReadLen = buf.writerIndex();
testInitiateCreationMsg = new byte[iReadLen];
buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}