### Question:
Payload { public void write(final ByteBuf bb, final AEAD aead, final long pn, final byte[] aad) { final ByteBuf raw = Unpooled.buffer(); for (final Frame frame : frames) { frame.write(raw); } final byte[] b = Bytes.drainToArray(raw); try { final byte[] sealed = aead.seal(b, pn, aad); bb.writeBytes(sealed); } catch (final GeneralSecurityException e) { throw new RuntimeException(e); } } 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 write() { final Payload payload = new Payload(PingFrame.INSTANCE, new PaddingFrame(1)); final ByteBuf bb = Unpooled.buffer(); payload.write(bb, aead, pn, aad); TestUtil.assertBuffer("e1eca61dcd946af283d48c55a5d25967efd6", bb); }