'Tesyt that loseConnection() doesn\'t close the channel until all
the data is sent.'

def test_loseConnection(self):

    self.channel.write('data')
    self.channel.writeExtended(1, 'datadata')
    self.channel.loseConnection()
    self.assertIsNone(self.conn.closes.get(self.channel))
    self.channel.addWindowBytes(4)
    self.assertIsNone(self.conn.closes.get(self.channel))
    self.channel.addWindowBytes(8)
    self.assertTrue(self.conn.closes.get(self.channel))
