'Test sendStreamError on a receiving xmlstream without having sent a
header.
In this case, a header should be generated. Then, the error should
be sent out on the stream followed by closing the connection.'

def test_sendStreamErrorReceivingNoHeader(self):

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