### Question:
AckFrame extends Frame { @Override public void write(final ByteBuf bb) { bb.writeByte(getType().getType()); final AckBlock firstBlock = blocks.get(0); Varint.write(firstBlock.getLargest(), bb); Varint.write(ackDelay, bb); Varint.write((blocks.size() - 1) * 2, bb); final long largest = firstBlock.getLargest(); long smallest = firstBlock.getSmallest(); Varint.write(largest - smallest, bb); for (int i = 1; i < blocks.size(); i++) { final AckBlock block = blocks.get(i); final long gap = smallest - block.getLargest() - 1; Varint.write(gap, bb); final long nextBlock = block.getLargest() - block.getSmallest(); smallest = block.getSmallest(); Varint.write(nextBlock, bb); } } AckFrame(final long ackDelay, final AckBlock... blocks);  AckFrame(final long ackDelay, final List<AckBlock> blocks); static AckFrame parse(final ByteBuf bb); long getAckDelay(); List<AckBlock> getBlocks(); @Override void write(final ByteBuf bb); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void writeSinglePacket() { final List<AckBlock> blocks = List.of(new AckBlock(100, 100)); final AckFrame frame = new AckFrame(1234, blocks); final ByteBuf bb = Unpooled.buffer(); frame.write(bb); assertEquals("02406444d20000", Hex.hex(Bytes.drainToArray(bb))); }