private static DnsQuery newQuery(ByteBuf buf, DnsQueryFactory supplier) {
        final int id = buf.readUnsignedShort();
        final int flags = buf.readUnsignedShort();
        if (flags >> 15 == 1) {
            throw new CorruptedFrameException("not a query");
        }

        final DnsQuery query = supplier.newQuery(id, DnsOpCode.valueOf((byte) (flags >> 11 & 0xf)));
        query.setRecursionDesired((flags >> 8 & 1) == 1);
        query.setZ(flags >> 4 & 0x7);
        return query;
    }
Provides some utility methods for DNS message implementations.
core/src/test/java/com/linecorp/armeria/client/endpoint/dns/DnsMessageUtil.java