Fix slow notification listener tests

The notification listener tests have a listener endpoint that will stop
the listener thread when a certain number of messages have been
received. If this doesn't work, the main thread will time out its
join() after 5 seconds and the only way sign of this is that the test
took over 5 seconds.

Let's make stop_listener() return a boolean indicating whether the the
thread has stopped or we timed out, and assert that the thread has
stopped.

Fix a few cases where the thread hasn't stopped. In the 'two exchanges'
case, we send three messages but only two are to the exchanges we are
listening on. In the tests using the HANDLED return value, the info()
handler which stops the thread was never been called because that
endpoint was last in the endpoints list.

Change-Id: Iea2486f23cee073c3891188d7aabb22ae945900d
Merge "Fix slow notification listener tests"