code: public Packet setPacketType(Packet.Type type) {
          int nonTypeFlags = flags & (~FLAG_TYPE0 & ~FLAG_TYPE1 & ~FLAG_TYPE2);
          resetFlagsTo(type.headerEncoding | nonTypeFlags);
          return this;
      }
docs: Sets the packet type by updating the packet type bits in the {@code flags} bitfield. Other bits
  are unaffected.
  
  @param type the type to set
  @return {@code this} (for fluent interface)