protected function _doRequest($namespace, $method, $args)
    {
        // Create the authorization header.
        $authorization = '';
        if (!is_null($this->_username) && !is_null($this->_password)) {
            $authorization = "\r\nAuthorization: Basic " . base64_encode($this->_username . ':' . $this->_password);
        }

        // Create the HTTP request.
        $xmlRpc = \xmlrpc_encode_request("$namespace.$method", $args, array('encoding' => 'utf-8'));
        $httpRequest = "POST /RPC2 HTTP/1.0\r\n" .
            "Content-Length: " . strlen($xmlRpc) .
            $authorization .
            "\r\n\r\n" .
            $xmlRpc;

        // Write the request to the socket.
        fwrite($this->_getSocket(), $httpRequest);
    }