當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。