private function startStreamSocket(ApiClient $apiClient, HttpRequest $request) {
		$this->configureRequest($request);

		$socket = $this->createSocketStream($apiClient, $request);
		$message = $request->toString();

		if ($apiClient->isDebuggingEnabled()) {
			error_log("[DEBUG] HTTP Request  ~BEGIN~".PHP_EOL.$message.PHP_EOL."~END~".PHP_EOL, 3, $apiClient->getDebugFile());
		}

		$result = fwrite($socket, $message);
		if ($result == false) {
			throw new ConnectionException($request->getUrl(), $request->getLogToken(), 'Could not send the message to the server.');
		}
		return $socket;
	}