code: public function createConnection($method, $timeout)
      {
          $socket = $this->createSocket(
                  $this->proxy->getScheme() ? $this->proxy->getScheme() : 'http',
                  $this->proxy->getHost(),
                  $this->proxy->getPort() ? $this->proxy->getPort() : 8080,
                  $timeout);
          if ($socket->isError()) {
              return $socket;
          }
          $socket->write($this->getRequestLine($method) . "\r\n");
          $socket->write($this->getHostLine() . "\r\n");
          if ($this->username && $this->password) {
              $socket->write('Proxy-Authorization: Basic ' .
                      base64_encode($this->username . ':' . $this->password) .
                      "\r\n");
          }
          $socket->write("Connection: close\r\n");
  
          return $socket;
      }
docs: Opens a socket to the route.
  
  @param string $method       HTTP request method, usually GET.
  @param int $timeout     Connection timeout.
  
  @return SimpleSocket        New socket.