SignalR/SignalR — pull request #3271 by moozzyk (2014-09-16 21:39:04+00:00)
Title: Ready...Set...Fail - fixing a race in the `CancelledTaskHandledinLongPol...

...lingLoop` test

The `CancelledTaskHandledinLongPollingLoop` test is returning a cancelled task from the poll request and then is checking if the OnError method with the `OperationCancelledException` argument was invoked. It used a wait handle to block the test until the poll request returns. However the `OnError` method is invoked on a different thread and therefore the test may fail due to a race condition if the test starts verification before the `OnError` method is actually called. The fix is to wait with the verification until the `OnError` is called (or fail if it is not called within 2 seconds) to avoid the race.