'Test sendStreamError on an initiating xmlstream with a header sent.
An error should be sent out and the connection lost.'

def test_sendStreamErrorInitiating(self):

    xs = self.xmlstream
    xs.initiating = True
    xs.sendHeader()
    xs.transport.clear()
    xs.sendStreamError(error.StreamError('version-unsupported'))
    self.assertNotEqual('', xs.transport.value())
    self.assertTrue(self.gotStreamEnd)
