'Disconnect whatever our state is.'

def disconnect(self):

    if (self.state == 'connecting'):
        self.stopConnecting()
    elif (self.state == 'connected'):
        self.transport.loseConnection()
