public async Task Do()
{
var messages = new ConcurrentQueue <TransportMessage>();
messages.Enqueue(new TransportMessage());
messages.Enqueue(new TransportMessage());
messages.Enqueue(new TransportMessage());
var countdown = new AsyncCountdownEvent(3);
var pipelineFactory = new ChainFactory();
pipelineFactory.Register(() => new LogStep(countdown));
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayAfter());
pipelineFactory.Register(() => new DelayAfter());
pipelineFactory.Register(() => new DelayAfter());
pipelineFactory.Register(() => new DelayAfter());
pipelineFactory.Register(() => new DelayAfter());
pipelineFactory.Register(() => new DelayInUsing());
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayAfter());
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayAfter());
pipelineFactory.Register(() => new PassThrough());
pipelineFactory.Register(() => new PassThrough());
pipelineFactory.Register(() => new PassThrough());
pipelineFactory.Register(() => new DelayInUsing());
pipelineFactory.Register(() => new DelayBefore());
pipelineFactory.Register(() => new DelayAfter());
pipelineFactory.Register(() => new PassThrough());
pipelineFactory.Register(() => new PassThrough());
pipelineFactory.Register(() => new PassThrough());
pipelineFactory.Register(() => new ThrowException());
var strategy = new PushMessages(messages, maxConcurrency: 1);
await strategy.StartAsync(tm => Connector(pipelineFactory, tm));
await Task.Delay(2000);
await strategy.StopAsync();
}