'Test send after XML stream disconnection.
The data should be cached until a new XML stream has been established
and initialized.'

def test_sendDisconnected(self):

    factory = xmlstream.XmlStreamFactory(xmlstream.Authenticator())
    sm = xmlstream.StreamManager(factory)
    handler = DummyXMPPHandler()
    sm.addHandler(handler)
    xs = factory.buildProtocol(None)
    xs.connectionMade()
    xs.transport = proto_helpers.StringTransport()
    xs.connectionLost(None)
    sm.send('<presence/>')
    self.assertEqual('', xs.transport.value())
    self.assertEqual('<presence/>', sm._packetQueue[0])
