public void A13_TimeoutedResponseReceiver() { ClientMock aClient = new ClientMock(MessagingSystem, ChannelId); ServiceMock aService = new ServiceMock(MessagingSystem, ChannelId); try { aService.InputChannel.StartListening(); // Open the connection. aClient.OutputChannel.OpenConnection(); Assert.IsTrue(aClient.OutputChannel.IsConnected); // handling open connection on the client side. EneterTrace.Info("1"); aClient.WaitUntilConnectionOpenIsNotified(2000); Assert.AreEqual(aClient.OutputChannel.ChannelId, aClient.NotifiedOpenConnection.ChannelId); Assert.AreEqual(aClient.OutputChannel.ResponseReceiverId, aClient.NotifiedOpenConnection.ResponseReceiverId); // handling open connection on the service side. EneterTrace.Info("2"); aService.WaitUntilResponseReceiversConnectNotified(1, 1000); Assert.AreEqual(1, aService.ConnectedResponseReceivers.Count()); Assert.AreEqual(aClient.OutputChannel.ResponseReceiverId, aService.ConnectedResponseReceivers[0].ResponseReceiverId); aClient.OutputChannel.CloseConnection(); Assert.IsFalse(aClient.OutputChannel.IsConnected); // Service will disconnect the response receiver when the offline timout is exceeded. EneterTrace.Info("3"); aService.WaitUntilAllResponseReceiversDisconnectNotified(2000); Assert.AreEqual(1, aService.DisconnectedResponseReceivers.Count()); Assert.AreEqual(aClient.OutputChannel.ResponseReceiverId, aService.DisconnectedResponseReceivers.First().ResponseReceiverId); } finally { EneterTrace.Debug("CLEANING AFTER TEST"); aClient.OutputChannel.CloseConnection(); aService.InputChannel.StopListening(); // Wait for traces. Thread.Sleep(100); } }