'Test that waiter handler is removed after timeout.'

def testWaiterTimeout(self):

    def waiter_handler(stanza):
        iq = self.xmpp.Iq()
        iq['id'] = 'test2'
        iq['type'] = 'set'
        iq['query'] = 'test2'
        try:
            reply = iq.send(block=True, timeout=0)
        except IqTimeout:
            pass
    self.xmpp.add_event_handler('message', waiter_handler, threaded=True)
    self.recv('<message><body>Start    Test</body></message>')
    iq = self.Iq()
    iq['id'] = 'test2'
    iq['type'] = 'set'
    iq['query'] = 'test2'
    self.send(iq)
    time.sleep(0.1)
    waiter_exists = self.xmpp.remove_handler('IqWait_test2')
    self.failUnless((waiter_exists == False), 'Waiter    handler    was    not    removed.')
