public static ByteBuffer serializeMetadata(WorkerState workerState) {
        Struct struct = new Struct(CONFIG_STATE_V0);
        struct.set(URL_KEY_NAME, workerState.url());
        struct.set(CONFIG_OFFSET_KEY_NAME, workerState.offset());
        ByteBuffer buffer = ByteBuffer.allocate(CONNECT_PROTOCOL_HEADER_V0.sizeOf() + CONFIG_STATE_V0.sizeOf(struct));
        CONNECT_PROTOCOL_HEADER_V0.writeTo(buffer);
        CONFIG_STATE_V0.write(buffer, struct);
        buffer.flip();
        return buffer;
    }
The fields are serialized in sequence as follows:
Subscription V0:
<pre>
  Version            => Int16
  Url                => [String]
  ConfigOffset       => Int64
</pre>

@param workerState the current state of the worker metadata
@return the serialized state of the worker metadata
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/ConnectProtocol.java