public async Task Reconnection_when_started_in_background()
        {
            var mock = new Mock <HttpMessageHandler>();

            mock.Protected().As <IHttpMessageHandlerProtected>()
            .SetupSequence(h => h.SendAsync(It.IsAny <HttpRequestMessage>(), It.IsAny <CancellationToken>()))
            .ThrowsAsync(new HttpRequestException("mock raising exception"))
            .ReturnsAsync(BuildBayeuxResponse(successfulHandshakeResponse))
            .ReturnsAsync(BuildBayeuxResponse(successfulConnectResponse))
            .ReturnsIndefinitely(() =>
                                 Task.Delay(TimeSpan.FromSeconds(5))
                                 .ContinueWith(t => BuildBayeuxResponse(successfulConnectResponse)))
            ;

            var bayeuxClient = new BayeuxClient(
                new HttpLongPollingTransportOptions()
            {
                HttpClient = new HttpClient(mock.Object), Uri = Url
            },
                reconnectDelays: new[] { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2) });

            using (bayeuxClient)
            {
                bayeuxClient.StartInBackgroundAsync();
                await Task.Delay(TimeSpan.FromSeconds(20));
            }
        }