@Test
public void testDecodePtrRecord() throws Exception {

    DefaultDnsRecordDecoder decoder = new DefaultDnsRecordDecoder();
    ByteBuf buffer = Unpooled.buffer().writeByte(0);
    int readerIndex = buffer.readerIndex();
    int writerIndex = buffer.writerIndex();
    try {
        DnsPtrRecord record = (DnsPtrRecord) decoder.decodeRecord(
                "netty.io", DnsRecordType.PTR, DnsRecord.CLASS_IN, 60, buffer, 0, 1);
        assertEquals("netty.io.", record.name());
        assertEquals(DnsRecord.CLASS_IN, record.dnsClass());
        assertEquals(60, record.timeToLive());
        assertEquals(DnsRecordType.PTR, record.type());
        assertEquals(readerIndex, buffer.readerIndex());
        assertEquals(writerIndex, buffer.writerIndex());
    } finally {
        buffer.release();
    }
}