'Helper function to check if the transport disconnected.'

def checkDisconnected(self, kind=None):

    if (kind is None):
        kind = transport.DISCONNECT_PROTOCOL_ERROR
    self.assertEqual(self.packets[(-1)][0], transport.MSG_DISCONNECT)
    self.assertEqual(self.packets[(-1)][1][3:4], chr(kind))
