Fix #159. Use blocking wait with timeout for checking mail in tests

@cpatrick Ready for QA