public void TearDown()
 {
     testCancellationTokenSource?.Dispose();
     MessagePump?.Stop().GetAwaiter().GetResult();
     TransportInfrastructure?.Stop().GetAwaiter().GetResult();
     Configurer?.Cleanup().GetAwaiter().GetResult();
 }
        public async Task Stop()
        {
            Log.Info("Initiating shutdown.");

            try
            {
                await transportInfrastructure.Stop().ConfigureAwait(false);
            }
            catch (TaskCanceledException)
            {
                //Ignore when shutting down
            }
            finally
            {
                settings.Clear();
                Log.Info("Shutdown complete.");
            }
        }