'Test that disconnection messages are received correctly.  See
test_sendDisconnect.'

def test_receiveDisconnect(self):

    disconnected = [False]
    def stubLoseConnection():
        disconnected[0] = True
    self.transport.loseConnection = stubLoseConnection
    self.proto.dispatchMessage(transport.MSG_DISCONNECT, '\x00\x00\x00\xff\x00\x00\x00\x04test')
    self.assertEqual(self.proto.errors, [(255, 'test')])
    self.assertTrue(disconnected[0])
