'Bytes sent over the extended channel for stderr data are delivered to
the channel\'s C{extReceived} method.'

def test_errorChannel(self):

    channel = self._ourServerOurClientTest(localWindow=4, localMaxPacket=5)
    def cbChannel(channel):
        self.channel = channel
        return channel.conn.sendRequest(channel, 'exec', common.NS('eecho    hello'), 1)
    channel.addCallback(cbChannel)
    def cbExec(ignored):
        return defer.gatherResults([self.channel.onClose, self.realm.avatar._testSession.onClose])
    channel.addCallback(cbExec)
    def cbClosed(ignored):
        self.assertEqual(self.channel.received, [])
        self.assertEqual(''.join(self.channel.receivedExt), 'hello\r\n')
        self.assertEqual(self.channel.status, 0)
        self.assertTrue(self.channel.eofCalled)
        self.assertEqual(self.channel.localWindowLeft, 4)
        self.assertEqual(self.channel.localWindowLeft, self.realm.avatar._testSession.remoteWindowLeftAtClose)
    channel.addCallback(cbClosed)
    return channel
