public function setCurrentConnection($connection = null, $server = null)
    {
        $connectionKey = $connection instanceof ConnectionKey ? $connection : $this->credentials->createConnectionKey($connection, $server);
        if ($this->current === $connectionKey->toHandle()) {
            return;
        }

        $this->current = $connectionKey->toHandle();
        $this->available = $this->getConnections()->map(function (ConnectionInterface $connection) use ($connectionKey) {
            $isCurrent = $connectionKey->is($connection->getConnectionKey());
            $connection->setCurrent($isCurrent);

            return $connection;
        });

        // Update events
        $this->bootstrapper->bootstrapUserCode();
    }