/**
  * @return SabreAMF_Client
  */
 protected function _buildSabreAmfClient()
 {
     if (!class_exists('SabreAMF_Client', true)) {
         @(require_once 'SabreAMF/Client.php');
     }
     if (!class_exists('SabreAMF_Client', true)) {
         throw new Exception('For using `sfPhpunitAmfClient` you need to have SabreAMF 1.3.x or above. It can be stored in project lib or installed throught PEAR. For more info please visit: http://osflash.org/sabreamf');
     }
     $c = new SabreAMF_Client($this->_endPoint);
     if (!is_null($this->_encoding)) {
         $c->setEncoding($this->_encoding);
     }
     if (!is_null($this->_httpProxy)) {
         $c->setHttpProxy($this->_httpProxy);
     }
     if (is_array($this->_credentials)) {
         $c->setCredentials($this->_credentials['username'], $this->_credentials['password']);
     }
     if (is_array($this->_header)) {
         foreach ($this->_header as $data) {
             $c->setHeader($data['name'], $data['required'], $data['data']);
         }
     }
     return $c;
 }