本文整理汇总了Java中org.jboss.netty.buffer.ChannelBuffers.copiedBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java ChannelBuffers.copiedBuffer方法的具体用法?Java ChannelBuffers.copiedBuffer怎么用?Java ChannelBuffers.copiedBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.netty.buffer.ChannelBuffers
的用法示例。
在下文中一共展示了ChannelBuffers.copiedBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetLsaBodyAsByteArray
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests getLsaBodyAsByteArray() method.
*/
@Test
public void testGetLsaBodyAsByteArray() throws Exception {
opqueHeader = new OpaqueLsaHeader();
opqueHeader.setLsType(11);
opqueHeader.setLsPacketLen(48);
opqueHeader.setLsCheckSum(10);
opqueHeader.setAge(4);
opqueHeader.setOpaqueId(1);
opqueHeader.setOpaqueType(11);
opqueHeader.setLsSequenceNo(250);
opqueHeader.setAdvertisingRouter(Ip4Address.valueOf("100.226.165.165"));
opqueHeader.setOptions(2);
opaqueLsa11 = new OpaqueLsa11(opqueHeader);
channelBuffer = ChannelBuffers.copiedBuffer(packet);
opaqueLsa11.readFrom(channelBuffer);
result = opaqueLsa11.getLsaBodyAsByteArray();
assertThat(result, is(notNullValue()));
}
示例2: testGetLsaBodyAsByteArray2
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests getLsaBodyAsByteArray() method.
*/
@Test(expected = Exception.class)
public void testGetLsaBodyAsByteArray2() throws Exception {
opqueHeader = new OpaqueLsaHeader();
opqueHeader.setLsType(10);
opqueHeader.setLsPacketLen(48);
opqueHeader.setLsCheckSum(10);
opqueHeader.setAge(4);
opqueHeader.setOpaqueId(1);
opqueHeader.setOpaqueType(10);
opqueHeader.setLsSequenceNo(250);
opqueHeader.setAdvertisingRouter(Ip4Address.valueOf("100.226.165.165"));
opqueHeader.setOptions(2);
opaqueLsa10 = new OpaqueLsa10(opqueHeader);
linkTlv = new LinkTlv(new TlvHeader());
opaqueLsa10.addValue(linkTlv);
channelBuffer = ChannelBuffers.copiedBuffer(packet);
opaqueLsa10.readFrom(channelBuffer);
result = opaqueLsa10.getLsaBodyAsByteArray();
assertThat(result, is(notNullValue()));
}
示例3: testAsBytes
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests asBytes() method.
*/
@Test(expected = Exception.class)
public void testAsBytes() throws Exception {
opqueHeader = new OpaqueLsaHeader();
opqueHeader.setLsType(10);
opqueHeader.setLsPacketLen(48);
opqueHeader.setLsCheckSum(10);
opqueHeader.setAge(4);
opqueHeader.setOpaqueId(1);
opqueHeader.setOpaqueType(10);
opqueHeader.setLsSequenceNo(250);
opqueHeader.setAdvertisingRouter(Ip4Address.valueOf("100.226.165.165"));
opqueHeader.setOptions(66);
opaqueLsa10 = new OpaqueLsa10(opqueHeader);
channelBuffer = ChannelBuffers.copiedBuffer(packet);
opaqueLsa10.readFrom(channelBuffer);
result = opaqueLsa10.getLsaBodyAsByteArray();
result = opaqueLsa10.asBytes();
assertThat(result, is(notNullValue()));
}
示例4: testReadFrom
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
header = new TlvHeader();
header.setTlvType(6);
header.setTlvLength(4);
channelBuffer = ChannelBuffers.copiedBuffer(packet);
maximumReservableBandwidth = new MaximumReservableBandwidth(header);
maximumReservableBandwidth.readFrom(channelBuffer);
assertThat(maximumReservableBandwidth, is(notNullValue()));
}
示例5: testReadFrom
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(tlv);
isisNeighborTlv.readFrom(channelBuffer);
assertThat(isisNeighborTlv.neighbor().size(), is(1));
}
示例6: testAsBytes
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests asByte() method.
*/
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(helloL1L2);
l1L2HelloPdu.readFrom(channelBuffer);
result = l1L2HelloPdu.asBytes();
assertThat(l1L2HelloPdu, is(notNullValue()));
}
示例7: testAsBytes
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests asBytes() method.
*/
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(tlv);
protocolSupportedTlv.readFrom(channelBuffer);
result = protocolSupportedTlv.asBytes();
assertThat(result, is(notNullValue()));
}
示例8: testCrc16
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
@Test
public void testCrc16() {
ChannelBuffer buf = ChannelBuffers.copiedBuffer("123456789", StandardCharsets.US_ASCII);
Assert.assertEquals(0x906e, Checksum.crc16(Checksum.CRC16_X25, buf.toByteBuffer()));
Assert.assertEquals(0x29b1, Checksum.crc16(Checksum.CRC16_CCITT_FALSE, buf.toByteBuffer()));
Assert.assertEquals(0x2189, Checksum.crc16(Checksum.CRC16_KERMIT, buf.toByteBuffer()));
Assert.assertEquals(0x31c3, Checksum.crc16(Checksum.CRC16_XMODEM, buf.toByteBuffer()));
Assert.assertEquals(0xe5cc, Checksum.crc16(Checksum.CRC16_AUG_CCITT, buf.toByteBuffer()));
Assert.assertEquals(0xd64e, Checksum.crc16(Checksum.CRC16_GENIBUS, buf.toByteBuffer()));
Assert.assertEquals(0x6f91, Checksum.crc16(Checksum.CRC16_MCRF4XX, buf.toByteBuffer()));
}
示例9: testReadFrom1
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom1() throws Exception {
tlvHeader = new TlvHeader();
tlvHeader.setTlvType(3);
tlvHeader.setTlvLength(4);
interfaceIpAddress = new NeighborIpAddress(tlvHeader);
channelBuffer = ChannelBuffers.copiedBuffer(packet1);
interfaceIpAddress.readFrom(channelBuffer);
assertThat(interfaceIpAddress, is(notNullValue()));
}
示例10: testReadFrom
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(internalReachability);
reachability.readFrom(channelBuffer);
assertThat(reachability, is(notNullValue()));
}
示例11: testReadFrom
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
inputByteArray = createByteForNetworkLsa();
lsaHeader = createLsaHeader();
asbrSummaryLsa = new AsbrSummaryLsa(lsaHeader);
channelBuffer = ChannelBuffers.copiedBuffer(inputByteArray);
asbrSummaryLsa.readFrom(channelBuffer);
assertThat(asbrSummaryLsa, is(notNullValue()));
}
示例12: testAsBytes
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests asBytes() method.
*/
@Test
public void testAsBytes() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(tlv);
areaAddressTlv.readFrom(channelBuffer);
result1 = areaAddressTlv.asBytes();
assertThat(result1, is(notNullValue()));
}
示例13: testReadFrom
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(tlv);
paddingTlv.readFrom(channelBuffer);
assertThat(paddingTlv, is(notNullValue()));
}
示例14: testReadFrom1
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom1() throws Exception {
tlvHeader = new TlvHeader();
tlvHeader.setTlvType(4);
tlvHeader.setTlvLength(4);
remoteInterfaceIpAddress = new RemoteInterfaceIpAddress(tlvHeader);
channelBuffer = ChannelBuffers.copiedBuffer(packet1);
remoteInterfaceIpAddress.readFrom(channelBuffer);
assertThat(remoteInterfaceIpAddress, is(notNullValue()));
}
示例15: testReadFrom
import org.jboss.netty.buffer.ChannelBuffers; //导入方法依赖的package包/类
/**
* Tests readFrom() method.
*/
@Test
public void testReadFrom() throws Exception {
channelBuffer = ChannelBuffers.copiedBuffer(tlv);
protocolSupportedTlv.readFrom(channelBuffer);
supported = protocolSupportedTlv.protocolSupported();
assertThat(supported.size(), is(1));
}