square/otto — pull request #28 by loganj (2012-10-15 17:40:46+00:00)
Title: add found handlers, then dispatch produced events

Do this in two passes rather than one to avoid an IllegalArgumentException
when a handler attempts to unregister from the bus.

There's no new test case here because this was sort of a heisenbug. Whether or not unregister succeeded depended upon the (arbitrary) order in which handlers we processed during registration.