### Question:
MysqlResponseClassifier extends ResponseClassifier { @Override public List<byte[]> toPackets() { ArrayList<byte[]> packets = new ArrayList<byte[]>(); ColCount colCount = new ColCount(); colCount.sequenceId = this.sequenceId; this.sequenceId++; colCount.colCount = this.columns.size(); packets.add(colCount.toPacket()); for (byte[] col : this.columns) { System.arraycopy(Proto.build_fixed_int(1, this.sequenceId), 0, col, 3, 1); this.sequenceId++; packets.add(col); } EOF eof = new EOF(); eof.sequenceId = this.sequenceId; this.sequenceId++; packets.add(eof.toPacket()); for (byte[] row : this.rows) { System.arraycopy(Proto.build_fixed_int(1, this.sequenceId), 0, row, 3, 1); this.sequenceId++; packets.add(row); } eof = new EOF(); eof.sequenceId = this.sequenceId; this.sequenceId++; packets.add(eof.toPacket()); return packets; }  @Override Optional<byte[]> getCommandComplete(); @Override void setCommandComplete(byte[] commandComplete); @Override Optional<byte[]> getReadyForQuery(); @Override void setReadyForQuery(byte[] readyForQuery); @Override List<byte[]> toPackets(); public long sequenceId; }### Answer:
@Test public void testToPackets() throws Exception { ResponseClassifier responseClassifier = new MysqlResponseClassifier(); responseClassifier.addColumn(colDef); responseClassifier.addRow(row); List<byte[]> toPackets = responseClassifier.toPackets(); ColCount colColunt = ColCount.loadFromPacket(toPackets.get(0)); assertEquals(colColunt.sequenceId, 1); assertEquals(colColunt.colCount, 1); Column column = Column.loadFromPacket(toPackets.get(1)); assertEquals(column.catalog, "def"); assertEquals(column.table, "dal_sequences"); assertEquals(column.org_table, "dal_sequences"); assertEquals(column.name, "seq_name"); assertEquals(column.org_name, "seq_name"); assertEquals(column.characterSet, 33); assertEquals(column.type, 253); assertEquals(column.decimals, 0); assertEquals(Packet.getType(toPackets.get(2)), Flags.EOF); Row row = Row.loadFromPacket(toPackets.get(3), 1); assertEquals(row.data.size(), 1); assertEquals((String) row.data.get(0), "apollo_tracking_shard_id_dev"); assertEquals(Packet.getType(toPackets.get(4)), Flags.EOF); }