@Override
    public void writeTo(MysqlSerializer serializer) {
        MysqlCapability capability = serializer.getCapability();

        serializer.writeInt1(EOF_INDICATOR);
        if (capability.isProtocol41()) {
            serializer.writeInt2(WARNINGS);
            serializer.writeInt2(serverStatus);
        }
    }
@Test
    public void testWrite() {
        MysqlEofPacket packet = new MysqlEofPacket(new QueryState());
        MysqlSerializer serializer = MysqlSerializer.newInstance(capability);

        packet.writeTo(serializer);

        ByteBuffer buffer = serializer.toByteBuffer();

        // assert indicator(int1): 0
        Assert.assertEquals(0xfe, MysqlProto.readInt1(buffer));

        // assert warnings(int2): 0
        Assert.assertEquals(0x00, MysqlProto.readInt2(buffer));

        // assert status flags(int2): 0
        Assert.assertEquals(0x00, MysqlProto.readInt2(buffer));

        Assert.assertEquals(0, buffer.remaining());
    }