public function setProxy($proxy, $username = null, $password = null){
        $this->proxy = $proxy;
        if($username != null && $password != null){
            $this->proxyCredentials = $username . ":" . $password;
        }
    }