[Reviewer: Alex] Speed up unit tests that need to wait for a signal

I closed my previous pull request here and took an approach similar to https://github.com/Metaswitch/sprout/pull/620. Brings Sprout UTs on my machine from ~15s to ~3.5s.
I think it would actually be clearer to do the wrapping maths here!