testDecodeCompressionRDataPointerMX() — netty Function Reference
Architecture documentation for the testDecodeCompressionRDataPointerMX() function in DefaultDnsRecordDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 61196592_34f2_ca4d_f8c5_fee310fff0d9["testDecodeCompressionRDataPointerMX()"] 818a470d_46ea_7cd1_0f64_8b71e08f0a90["DefaultDnsRecordDecoderTest"] 61196592_34f2_ca4d_f8c5_fee310fff0d9 -->|defined in| 818a470d_46ea_7cd1_0f64_8b71e08f0a90 style 61196592_34f2_ca4d_f8c5_fee310fff0d9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-dns/src/test/java/io/netty/handler/codec/dns/DefaultDnsRecordDecoderTest.java lines 169–212
@Test
public void testDecodeCompressionRDataPointerMX() throws Exception {
DefaultDnsRecordDecoder decoder = new DefaultDnsRecordDecoder();
byte[] compressionPointer = {
5, 'n', 'e', 't', 't', 'y', 2, 'i', 'o', 0,
0, 10, // preference = 10
(byte) 0xC0, 0 // record is a pointer to netty.io
};
byte[] expected = {
0, 10, // pref = 10
5, 'n', 'e', 't', 't', 'y', 2, 'i', 'o', 0
};
ByteBuf buffer = Unpooled.wrappedBuffer(compressionPointer);
DefaultDnsRawRecord mxRecord = null;
ByteBuf expectedBuf = null;
try {
mxRecord = (DefaultDnsRawRecord) decoder.decodeRecord(
"mail.example.com",
DnsRecordType.MX,
DnsRecord.CLASS_IN,
60,
buffer,
10,
4);
expectedBuf = Unpooled.wrappedBuffer(expected);
assertEquals(0, ByteBufUtil.compare(expectedBuf, mxRecord.content()),
"The rdata of MX-type record should be decompressed in advance");
assertEquals(10, mxRecord.content().getUnsignedShort(0));
ByteBuf exchangerName = mxRecord.content().duplicate().setIndex(2, mxRecord.content().writerIndex());
assertEquals("netty.io.", DnsCodecUtil.decodeDomainName(exchangerName));
} finally {
buffer.release();
if (expectedBuf != null) {
expectedBuf.release();
}
if (mxRecord != null) {
mxRecord.release();
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testDecodeCompressionRDataPointerMX() do?
testDecodeCompressionRDataPointerMX() is a function in the netty codebase, defined in codec-dns/src/test/java/io/netty/handler/codec/dns/DefaultDnsRecordDecoderTest.java.
Where is testDecodeCompressionRDataPointerMX() defined?
testDecodeCompressionRDataPointerMX() is defined in codec-dns/src/test/java/io/netty/handler/codec/dns/DefaultDnsRecordDecoderTest.java at line 169.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free