当前位置: 首页>>代码示例>>Java>>正文


Java ChannelBuffers.copiedBuffer方法代码示例

本文整理汇总了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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:OpaqueLsa11Test.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:OpaqueLsa10Test.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:OpaqueLsa10Test.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:MaximumReservableBandwidthTest.java

示例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));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:IsisNeighborTlvTest.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:L1L2HelloPduTest.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:ProtocolSupportedTlvTest.java

示例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()));
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:13,代码来源:ChecksumTest.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:InterfaceIpAddressTest.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:MetricOfInternalReachabilityTest.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:AsbrSummaryLsaTest.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:AreaAddressTlvTest.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:PaddingTlvTest.java

示例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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:RemoteInterfaceIpAddressTest.java

示例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));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:ProtocolSupportedTlvTest.java


注:本文中的org.jboss.netty.buffer.ChannelBuffers.copiedBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。