@Test
public void readResponseTest() throws Exception {
EmbeddedChannel embedder = new EmbeddedChannel(new DnsResponseDecoder());
for (byte[] p: packets) {
ByteBuf packet = embedder.alloc().buffer(512).writeBytes(p);
embedder.writeInbound(new DatagramPacket(packet, null, new InetSocketAddress(0)));
DnsResponse decoded = embedder.readInbound();
ByteBuf raw = Unpooled.wrappedBuffer(p);
Assert.assertEquals("Invalid id, expected: " + raw.getUnsignedShort(0) + ", actual: "
+ decoded.header().id(), raw.getUnsignedShort(0), decoded.header().id());