sender.send(messageBytes);
Thread.sleep(batchOutgoingMessagesDelayMillis * 2);
sender.send(messageBytes);
sender.send(messageBytes);
Thread.sleep(batchOutgoingMessagesDelayMillis * 2);
sender.send(messageBytes);
// now numBytesLastFlush should be set to the num of bytes that were last flushed.
// numBytesSent should be the total bytes, even those still in the buffer.
// Therefore numBytesSent - numBytesLastFlush should be the number of bytes waiting.
// These are asserted below.