docs: void authenticate() throws SFException, SnowflakeSQLException
    {
      ServerSocket ssocket = this.getServerSocket();
      try
      {
        // main procedure
        int port = this.getLocalPort(ssocket);
        logger.debug("Listening localhost:{}", port);
        String ssoUrl = getSSOUrl(port);
        this.handlers.output(
            "Initiating login request with your identity provider. A " +
            "browser window should have opened for you to complete the " +
            "login. If you can't see it, check existing browser windows, " +
            "or your OS settings. Press CTRL+C to abort and try again...");
        this.handlers.openBrowser(ssoUrl);
  
        while (true)
        {
          Socket socket = ssocket.accept(); // start accepting the request
          try
          {
            BufferedReader in = new BufferedReader(
                new InputStreamReader(socket.getInputStream(), UTF8_CHARSET));
            char[] buf = new char[16384];
            int strLen = in.read(buf);
            String[] rets = new String(buf, 0, strLen).split("\r\n");
            if (!processOptions(rets, socket))
            {
              processSamlToken(rets, socket);
              break;
            }
          }
          finally
          {
            socket.close();
          }
        }
      }
      catch (IOException ex)
      {
        throw new SFException(ex, ErrorCode.NETWORK_ERROR, ex.getMessage());
      }
      finally
      {
        try
        {
          ssocket.close();
        }
        catch (IOException ex)
        {
          throw new SFException(ex, ErrorCode.NETWORK_ERROR, ex.getMessage());
        }
      }
    }