### Question:
BinlogDumpCommandPacket extends AbstractCommandPacket { @Override public ByteBuf toByteBuf() { ByteBuf result = ByteBufAllocator.DEFAULT.heapBuffer(); DataTypesCodec.writeByte(getCommand(), result); DataTypesCodec.writeInt4LE((int) binlogPosition, result); byte binlogFlags = 0; binlogFlags |= BINLOG_SEND_ANNOTATE_ROWS_EVENT; DataTypesCodec.writeByte(binlogFlags, result); DataTypesCodec.writeByte((byte) 0x00, result); DataTypesCodec.writeInt4LE(this.slaveServerId, result); if (!Strings.isNullOrEmpty(this.binlogFileName)) { DataTypesCodec.writeBytes(this.binlogFileName.getBytes(), result); } return result; } BinlogDumpCommandPacket(); @Override ByteBuf toByteBuf();  }### Answer:
@Test public void assertToByteBuf() { BinlogDumpCommandPacket binlogDumpCommandPacket = new BinlogDumpCommandPacket(); binlogDumpCommandPacket.setBinlogFileName("binlog-000001"); binlogDumpCommandPacket.setBinlogPosition(4); binlogDumpCommandPacket.setSlaveServerId(1); assertThat(binlogDumpCommandPacket.toByteBuf(), is(getExpectedByteBuf())); }