Ejemplo n.º 1
0
 /**
  * Factory method.
  *
  * @param string $host Host name
  * @param int    $port Port number
  * @param bool   $ssl  SSL flag
  *
  * @return static Socket instance
  *
  * @see rex_socket::factoryUrl()
  */
 public static function factory($host, $port = 80, $ssl = false)
 {
     if (get_called_class() === __CLASS__ && ($proxy = rex::getProperty('socket_proxy'))) {
         return rex_socket_proxy::factoryUrl($proxy)->setDestination($host, $port, $ssl);
     }
     return new static($host, $port, $ssl);
 }
Ejemplo n.º 2
0
 public function testFactoryUrl()
 {
     $socket = rex_socket_proxy::factoryUrl('www.example.com');
     $this->assertEquals('rex_socket_proxy', get_class($socket));
 }