'If the factory is connected, close the connection.
Note that if you set up the factory to reconnect, you will need to
implement extra logic to prevent automatic reconnection after this
is called.'

def disconnect(self):

    if self._broker:
        self._broker.transport.loseConnection()
