'Test requesting a stream, successfully'

def testOpenStream(self):

    events = []
    def on_stream_start(stream):
        events.append('ibb_stream_start')
    self.xmpp.add_event_handler('ibb_stream_start', on_stream_start)
    t = threading.Thread(name='open_stream', target=self.xmpp['xep_0047'].open_stream, args=('tester@localhost/receiver',), kwargs={'sid': 'testing'})
    t.start()
    self.send('\n                                        <iq    type="set"    to="tester@localhost/receiver"    id="1">\n                                                <open    xmlns="http://jabber.org/protocol/ibb"\n                                                                        sid="testing"\n                                                                        block-size="4096"\n                                                                        stanza="iq"    />\n                                        </iq>\n                                ')
    self.recv('\n                                        <iq    type="result"    id="1"\n                                                        to="tester@localhost"\n                                                        from="tester@localhost/receiver"    />\n                                ')
    t.join()
    time.sleep(0.2)
    self.assertEqual(events, ['ibb_stream_start'])
