public function request($method, Endpoint $endpoint, $path, Message $message = null)
    {
        $message = $message ?: new Message();

        // We'll try to reach backend several times before throwing exception.
        $i = 0;
        do {
            ++$i;
            if ($responseMessage = $this->requestStream($method, $endpoint, $path, $message)) {
                return $responseMessage;
            }

            usleep($this->retryWaitMs * 1000);
        } while ($i < $this->connectionRetry);

        if ($this->logger instanceof LoggerInterface) {
            $this->logger->error(
                sprintf('Connection to %s failed, attempted %d times', $endpoint->getURL(), $this->connectionRetry)
            );
        }

        throw new ConnectionException($endpoint->getURL(), $path, $method);
    }