fix a thread-safety issue in MessageDispatcherTests