public async Task ReconnectionSuccesfulTest(HostType hostType, TransportType transportType, MessageBusType messageBusType) { using (var host = CreateHost(hostType, transportType)) { // Arrange var mre = new AsyncManualResetEvent(false); host.Initialize(keepAlive: null, messageBusType: messageBusType); var connection = CreateConnection(host, "/my-reconnect"); using (connection) { ((Client.IConnection)connection).KeepAliveData = new KeepAliveData(TimeSpan.FromSeconds(2)); connection.Reconnected += () => { mre.Set(); }; await connection.Start(host.Transport); Assert.True(await mre.WaitAsync(TimeSpan.FromSeconds(10))); // Clean-up mre.Dispose(); } } }