'Test using stream waiter handler.'

def testWaiter(self):

    def waiter_handler(stanza):
        iq = self.xmpp.Iq()
        iq['id'] = 'test'
        iq['type'] = 'set'
        iq['query'] = 'test'
        reply = iq.send(block=True)
        if reply:
            self.xmpp.send_raw(('\n                                                                        <message>\n                                                                                <body>Successful:    %s</body>\n                                                                        </message>\n                                                                ' % reply['query']))
    self.xmpp.add_event_handler('message', waiter_handler, threaded=True)
    self.recv('\n                                        <message>\n                                                <body>Testing</body>\n                                        </message>\n                                ')
    iq = self.Iq()
    iq['id'] = 'test'
    iq['type'] = 'set'
    iq['query'] = 'test'
    self.send(iq)
    self.recv('\n                                        <iq    id="test"    type="result">\n                                                <query    xmlns="test"    />\n                                        </iq>\n                                ')
    msg = self.Message()
    msg['body'] = 'Successful:    test'
    self.send(msg)
