### Question:
Payload { public static Payload parse( final ByteBuf bb, final int length, final AEAD aead, final long pn, final byte[] aad) { final byte[] cipherText = new byte[length]; bb.readBytes(cipherText); final byte[] raw; try { raw = aead.open(cipherText, pn, aad); } catch (final GeneralSecurityException e) { throw new RuntimeException(e); } final List<Frame> frames = new ArrayList<>(); final ByteBuf frameBuf = Unpooled.wrappedBuffer(raw); while (frameBuf.isReadable()) { final Frame frame = Frame.parse(frameBuf); frames.add(frame); } return new Payload(frames); } Payload(final List<Frame> frames);  Payload(final Frame... frames); static Payload parse(
      final ByteBuf bb, final int length, final AEAD aead, final long pn, final byte[] aad); List<Frame> getFrames(); Payload addFrame(final Frame frame); int calculateLength(); void write(final ByteBuf bb, final AEAD aead, final long pn, final byte[] aad); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void parse() { final ByteBuf bb = Unpooled.copiedBuffer(Hex.dehex("e1eca61dcd946af283d48c55a5d25967efd6")); final Payload parsed = Payload.parse(bb, bb.writerIndex(), aead, pn, aad); final Payload expected = new Payload(PingFrame.INSTANCE, new PaddingFrame(1)); assertEquals(expected, parsed); }