internal TopologyTestDriver(InternalTopologyBuilder builder, IStreamConfig config, Mode mode, IKafkaSupplier supplier)
        {
            topologyBuilder = builder;
            configuration   = config;

            // ONLY 1 thread for test driver (use only for ASYNC_CLUSTER_IN_MEMORY)
            configuration.NumStreamThreads = 1;
            configuration.Guarantee        = ProcessingGuarantee.AT_LEAST_ONCE;

            topicConfiguration = config.Clone();
            topicConfiguration.ApplicationId = $"test-driver-{configuration.ApplicationId}";

            var clientId = string.IsNullOrEmpty(configuration.ClientId) ? $"{configuration.ApplicationId.ToLower()}-{Guid.NewGuid()}" : configuration.ClientId;

            // sanity check
            topologyBuilder.BuildTopology();

            topologyBuilder.RewriteTopology(configuration);

            switch (mode)
            {
            case Mode.SYNC_TASK:
                behavior = new TaskSynchronousTopologyDriver(
                    clientId,
                    topologyBuilder,
                    configuration,
                    topicConfiguration,
                    supplier,
                    tokenSource.Token);
                break;

            case Mode.ASYNC_CLUSTER_IN_MEMORY:
                behavior = new ClusterInMemoryTopologyDriver(
                    clientId,
                    topologyBuilder,
                    configuration,
                    topicConfiguration,
                    supplier,
                    tokenSource.Token);
                break;
            }

            behavior.StartDriver();
        }