private static void TestBug1490652SendData(TestHelperOptions testOptions)
        {
            int           correlationID = 0;
            Random        rand          = new Random();
            StringBuilder sb            = new StringBuilder();

            try
            {
                KafkaSimpleManagerConfiguration config = new KafkaSimpleManagerConfiguration()
                {
                    Zookeeper      = testOptions.Zookeeper,
                    MaxMessageSize = SyncProducerConfiguration.DefaultMaxMessageSize
                };
                config.Verify();
                using (KafkaSimpleManager <int, Kafka.Client.Messages.Message> kafkaSimpleManager = new KafkaSimpleManager <int, Kafka.Client.Messages.Message>(config))
                {
                    TopicMetadata topicMetadata = kafkaSimpleManager.RefreshMetadata(0, "ClientID", correlationID++, testOptions.Topic, true);
                    PartitionCount = topicMetadata.PartitionsMetadata.Count();
                    List <ProducerData <int, Message> > listOfDataNeedSendInOneBatch = new List <ProducerData <int, Message> >();
                    for (int i = 0; i < PartitionCount; i++)
                    {
                        TestBug1490652DataSent.Add(i, new Dictionary <int, string>());
                        for (int j = 0; j < TestBug1490652MessageCountPerPartition; j++)
                        {
                            string val  = KafkaClientHelperUtils.GetRandomString(testOptions.MessageSize);
                            byte[] bVal = System.Text.Encoding.UTF8.GetBytes(val);
                            //Set the key to partitionID, so it can directly fall into  that partition.
                            Message message = new Message(bVal, CompressionCodecs.DefaultCompressionCodec);
                            listOfDataNeedSendInOneBatch.Add(new ProducerData <int, Message>(testOptions.Topic, i, message));
                            TestBug1490652DataSent[i].Add(j, val);
                        }
                    }

                    ProducerConfiguration producerConfig = new ProducerConfiguration(new List <BrokerConfiguration>()
                    {
                    })
                    {
                        PartitionerClass = ProducerConfiguration.DefaultPartitioner,
                        RequiredAcks     = 1,
                        BufferSize       = config.BufferSize,
                        ZooKeeper        = config.ZookeeperConfig,
                        MaxMessageSize   = Math.Max(config.MaxMessageSize, Math.Max(SyncProducerConfiguration.DefaultMaxMessageSize, testOptions.MessageSize))
                    };
                    producerConfig.SyncProducerOfOneBroker = 1;
                    Producer <int, Kafka.Client.Messages.Message> producer = new Producer <int, Kafka.Client.Messages.Message>(producerConfig);
                    producer.Send(listOfDataNeedSendInOneBatch);
                }
            }
            catch (Exception ex)
            {
                Logger.ErrorFormat("Produce data Got exception:{0}\r\ninput parameter: {1}\r\n"
                                   , ex.FormatException(), testOptions.ToString());
            }
        }
        /// <summary>
        /// Previously , the wrong exception hit when:
        ///     One broker is leader of multiple partition(>=2).
        ///     Send a group of message, and they need go to different partitions of the same broker.
        /// Preparation before run the case:
        ///     Assume we have 3 broker, then create topic as
        ///         .\bin\kafka.cmd topiccmd --create --topic mvlogsA --partition 4 --replication-factor 1 --zookeeper localhost
        ///     Then run this case by send more than 5 messages.
        /// </summary>
        /// <param name="testOptions"></param>
        /// <returns></returns>
        private static bool TestBug1490652(TestHelperOptions testOptions)
        {
            try
            {
                //Send data
                TestBug1490652SendData(testOptions);
                DumpDictToFile(TestBug1490652DataSent, "Sent.log");

                //Read data
                TestBug1490652ReadData(testOptions);
                DumpDictToFile(TestBug1490652DataRead, "Read.log");
                //Verify
                return(TestBug1490652Verify(testOptions));
            }
            catch (Exception e)
            {
                Logger.ErrorFormat("Dump topic got exception:{0}\r\ninput parameter: {1} \r\n"
                                   , e.FormatException(), testOptions.ToString());
                return(false);
            }
        }