public void AdminClient_NullReferenceChecks(string bootstrapServers)
        {
            LogToFile("start AdminClient_NullReferenceChecks");
            var    topicName1 = Guid.NewGuid().ToString();
            string nullTopic  = null;

            Exception createTopicsException     = null;
            Exception createPartitionsException = null;

            // test creating a null topic throws a related exception
            using (var producer = new ProducerBuilder <Null, Null>(new ProducerConfig {
                BootstrapServers = bootstrapServers
            }).Build())
                using (var adminClient = new DependentAdminClientBuilder(producer.Handle).Build())
                {
                    try
                    {
                        adminClient.CreateTopicsAsync(new TopicSpecification[] { new TopicSpecification {
                                                                                     Name = nullTopic, NumPartitions = 1, ReplicationFactor = 1
                                                                                 } }).Wait();
                        Assert.True(false, "Expected exception.");
                    }
                    catch (ArgumentException ex)
                    {
                        Assert.Contains("topic", ex.Message.ToLower());
                        createTopicsException = ex;
                    }
                }

            // test creating a partition with null topic throws exception
            using (var producer = new ProducerBuilder <Null, Null>(new ProducerConfig {
                BootstrapServers = bootstrapServers
            }).Build())
                using (var adminClient = new DependentAdminClientBuilder(producer.Handle).Build())
                {
                    try
                    {
                        adminClient.CreateTopicsAsync(new TopicSpecification[] { new TopicSpecification {
                                                                                     Name = topicName1, NumPartitions = 1, ReplicationFactor = 1
                                                                                 } }).Wait();
                        adminClient.CreatePartitionsAsync(new List <PartitionsSpecification> {
                            new PartitionsSpecification {
                                Topic = nullTopic, IncreaseTo = 2
                            }
                        }).Wait();
                        Assert.True(false, "Expected exception.");
                    }
                    catch (ArgumentException ex)
                    {
                        Assert.Contains("topic", ex.Message.ToLower());
                        createPartitionsException = ex;
                    }
                }

            Assert.True(createTopicsException != null && createPartitionsException != null);
            Assert.True(createTopicsException.GetType() == createPartitionsException.GetType(), ".CreateTopic and .CreatePartition should have consistent interface for null-related exceptions.");

            // test adding a null list of brokers throws null reference exception.
            using (var producer = new ProducerBuilder <Null, Null>(new ProducerConfig {
                BootstrapServers = bootstrapServers
            }).Build())
                using (var adminClient = new DependentAdminClientBuilder(producer.Handle).Build())
                {
                    try
                    {
                        adminClient.AddBrokers(null);
                        Assert.True(false, "Expected exception.");
                    }
                    catch (ArgumentNullException ex)
                    {
                        Assert.Contains("broker", ex.Message.ToLower());
                    }
                }

            // test retrieving metadata for a null topic
            using (var producer = new ProducerBuilder <Null, Null>(new ProducerConfig {
                BootstrapServers = bootstrapServers
            }).Build())
                using (var adminClient = new DependentAdminClientBuilder(producer.Handle).Build())
                {
                    try
                    {
                        adminClient.GetMetadata(null, TimeSpan.FromSeconds(10));
                        Assert.True(false, "Expected exception.");
                    }
                    catch (ArgumentNullException ex)
                    {
                        Assert.Contains("value cannot be null", ex.Message.ToLower());
                    }
                }

            // Deleting null topic throws exception
            using (var producer = new ProducerBuilder <Null, Null>(new ProducerConfig {
                BootstrapServers = bootstrapServers
            }).Build())
                using (var adminClient = new DependentAdminClientBuilder(producer.Handle).Build())
                {
                    try
                    {
                        adminClient.DeleteTopicsAsync(new List <string> {
                            topicName1, nullTopic
                        });
                        Assert.True(false, "Expected exception.");
                    }
                    catch (ArgumentException ex)
                    {
                        Assert.Contains("topic", ex.Message);
                    }
                }

            // ListGroup throws exception if group is null
            using (var producer = new ProducerBuilder <Null, Null>(new ProducerConfig {
                BootstrapServers = bootstrapServers
            }).Build())
                using (var adminClient = new DependentAdminClientBuilder(producer.Handle).Build())
                {
                    try
                    {
                        adminClient.ListGroup(null, TimeSpan.FromSeconds(10));
                        Assert.True(false, "Expected exception.");
                    }
                    catch (ArgumentNullException ex)
                    {
                        Assert.Contains("group", ex.Message);
                    }
                }

            Assert.Equal(0, Library.HandleCount);
            LogToFile("end   AdminClient_NullReferenceChecks");
        }