public static LegacySubscriptionInfoSerde decode(final ByteBuffer data) {

        // ensure we are at the beginning of the ByteBuffer
        data.rewind();

        final int usedVersion = data.getInt();
        if (usedVersion > 2 && usedVersion < 7) {
            final int latestSupportedVersion = data.getInt();
            final ProcessId processId = decodeProcessId(data);
            final Set<TaskId> prevTasks = decodeTasks(data, usedVersion);
            final Set<TaskId> standbyTasks = decodeTasks(data, usedVersion);
            final String userEndPoint = decodeUserEndpoint(data);
            return new LegacySubscriptionInfoSerde(usedVersion, latestSupportedVersion, processId, prevTasks, standbyTasks, userEndPoint);
        } else if (usedVersion == 2) {
            final ProcessId processId = decodeProcessId(data);
            final Set<TaskId> prevTasks = decodeTasks(data, usedVersion);
            final Set<TaskId> standbyTasks = decodeTasks(data, usedVersion);
            final String userEndPoint = decodeUserEndpoint(data);
            return new LegacySubscriptionInfoSerde(2, UNKNOWN, processId, prevTasks, standbyTasks, userEndPoint);
        } else if (usedVersion == 1) {
            final ProcessId processId = decodeProcessId(data);
            final Set<TaskId> prevTasks = decodeTasks(data, usedVersion);
            final Set<TaskId> standbyTasks = decodeTasks(data, usedVersion);
            return new LegacySubscriptionInfoSerde(1, UNKNOWN, processId, prevTasks, standbyTasks, null);
        } else {
            final int latestSupportedVersion = data.getInt();
            log.info("Unable to decode subscription data: used version: {}; latest supported version: {}", usedVersion, LATEST_SUPPORTED_VERSION);
            return new LegacySubscriptionInfoSerde(usedVersion, latestSupportedVersion, null, null, null, null);
        }
    }
@throws TaskAssignmentException if method fails to decode the data
streams/src/test/java/org/apache/kafka/streams/processor/internals/assignment/LegacySubscriptionInfoSerde.java