code: protected function createSocket($scheme, $host, $port, $timeout)
      {
          if (in_array($scheme, array('file'))) {
              return new SimpleFileSocket($this->url);
          } elseif (in_array($scheme, array('https'))) {
              return new SimpleSecureSocket($host, $port, $timeout);
          } else {
              return new SimpleSocket($host, $port, $timeout);
          }
      }
docs: Factory for socket.
  
  @param string $scheme                   Protocol to use.
  @param string $host                     Hostname to connect to.
  @param int $port                    Remote port.
  @param int $timeout                 Connection timeout.
  
  @return SimpleSocket/SimpleSecureSocket New socket.