protected function exec($query)
    {
        if (!$query) {
            throw new Exceptions\RPCException("Empty query.");
        }
        
        $url = sprintf("http://%s:%d", $this->conf["host"], $this->conf["port"]);
        $web = $this->getWebClient();
        $web->setMethod(HttpMethods::POST);
        $web->addHeader("Content-Type", "application/json");
        $web->setBasicAuth($this->conf["user"], $this->conf["pass"]);
        $web->setData($query);
        $response    = $web->request($url);
        $status_code = $response->getCode();
        
        if (isset(self::$exceptions[$status_code])) {
            $error = $this->getResponseError($response, $status_code);
            throw new self::$exceptions[$status_code](
                $error["message"],
                $error["code"]
            );
        }

        return $response;
    }