protected function getBaseUrl($withAuthentication = false)
    {
        $config = $this->getConfig();
        $baseUrl = $config['scheme'] . '://' . rtrim($config['host'], '/') . '/';

        if (isset($config['path'])) {
            $baseUrl .= trim($config['path'], '/') . '/';
        }

        if ($withAuthentication === true
            && $this->getConnector()->getListener() instanceof \Buzz\Listener\BasicAuthListener) {

            $baseUrl .= 'a/';
        }

        return $baseUrl;
    }