Disconnects.

        You probably don't need to use this unless you are writing
        unit tests.

def disconnect(self):
        """
        Disconnects.

        You probably don't need to use this unless you are writing
        unit tests.
        """
        if self._state == _State.CONNECTED:
            self._state = _State.DISCONNECTING
            self._transport.loseConnection()
            return self._notify_on_disconnect()
        if self._state == _State.CONNECTING:
            return fail(ClientConnecting())
        elif self._state == _State.NOT_CONNECTED:
            return succeed(None)
        elif self._state == _State.DISCONNECTING:
            return self._notify_on_disconnect()