### Question:
Utils { static byte encodeFlags(AbstractMessage message) { byte flags = 0; if (message.isDupFlag()) { flags |= 0x08; } if (message.isRetainFlag()) { flags |= 0x01; } flags |= ((message.getQos().ordinal() & 0x03) << 1); return flags; }   static final int MAX_LENGTH_LIMIT; }### Answer:
@Test public void testEncodeFlags() { UnsubscribeMessage msg = new UnsubscribeMessage(); msg.setRetainFlag(true); msg.setQos(AbstractMessage.QOSType.MOST_ONE); assertEquals(1, Utils.encodeFlags(msg)); }