public static ByteBuffer serializeAssignment(ExtendedAssignment assignment, boolean sessioned) {
        // comparison depends on reference equality for now
        if (assignment == null || ExtendedAssignment.empty().equals(assignment)) {
            return null;
        }
        Struct struct = assignment.toStruct();
        Struct protocolHeader = sessioned ? CONNECT_PROTOCOL_HEADER_V2 : CONNECT_PROTOCOL_HEADER_V1;
        ByteBuffer buffer = ByteBuffer.allocate(protocolHeader.sizeOf()
                                                + ASSIGNMENT_V1.sizeOf(struct));
        protocolHeader.writeTo(buffer);
        ASSIGNMENT_V1.write(buffer, struct);
        buffer.flip();
        return buffer;
    }
The fields are serialized in sequence as follows:
Complete Assignment V1:
<pre>
  Version            => Int16
  Error              => Int16
  Leader             => [String]
  LeaderUrl          => [String]
  ConfigOffset       => Int64
  Assignment         => [Connector Assignment]
  Revoked            => [Connector Assignment]
  ScheduledDelay     => Int32
</pre>
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/IncrementalCooperativeConnectProtocol.java