code: private static void encodeHeader(DnsResponse response, ByteBuf buf) {
          buf.writeShort(response.id());
          int flags = 32768;
          flags |= (response.opCode().byteValue() & 0xFF) << 11;
          if (response.isAuthoritativeAnswer()) {
              flags |= 1 << 10;
          }
          if (response.isTruncated()) {
              flags |= 1 << 9;
          }
          if (response.isRecursionDesired()) {
              flags |= 1 << 8;
          }
          if (response.isRecursionAvailable()) {
              flags |= 1 << 7;
          }
          flags |= response.z() << 4;
          flags |= response.code().intValue();
          buf.writeShort(flags);
          buf.writeShort(response.count(DnsSection.QUESTION));
          buf.writeShort(response.count(DnsSection.ANSWER));
          buf.writeShort(response.count(DnsSection.AUTHORITY));
          buf.writeShort(response.count(DnsSection.ADDITIONAL));
      }
docs: Encodes the header that is always 12 bytes long.
  
  @param response the response header being encoded
  @param buf      the buffer the encoded data should be written to