本文整理匯總了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));
}