'Test that the test socket can simulate disconnections.'

def testStreamDisconnect(self):

    self.stream_start()
    events = set()
    def stream_error(event):
        events.add('socket_error')
    self.xmpp.add_event_handler('socket_error', stream_error)
    self.stream_disconnect()
    self.xmpp.send_raw('        ')
    time.sleep(0.1)
    self.failUnless(('socket_error' in events), ('Stream    error    event    not    raised:    %s' % events))
