This resolves an issue arising from using both a callback and an EventEmitter
together in the Client.search() API. Since the emitter would only be available
through the callback, some events could be emitted before the callback
is triggered, resulting in missed events.
This change incorporates a test case originally by László Szűcs (@ifroz).
For GH-602