public async Task StartAsync() { Hub.BeginConnectionLoop(); Server.StartRunLoop(); await Task.Factory.StartNew(() => { while (!Token.IsCancellationRequested) { Thread.Sleep(TimeSpan.FromSeconds(1)); } }, TaskCreationOptions.LongRunning); await Server.StopRunLoopAsync(); Hub.EndConnectionLoop(); }