code: public static RemoteNodeInformation getRemoteNodeInfo(String hostName, int port, SessionId session) {
          logger.entering(new Object[] { hostName, port, session });
          RemoteNodeInformation node = null;
          String errorMsg = "Failed to acquire remote webdriver node and port info. Root cause: ";
  
          // go ahead and abort if this is a known grid where know we won't be able to extract the proxy info via the hub
          // api
          if (Config.getBoolConfigProperty(ConfigProperty.SELENIUM_USE_SAUCELAB_GRID)) {
              logger.exiting(node);
              return node;
          }
  
          try {
              HttpHost host = new HttpHost(hostName, port);
              CloseableHttpClient client = HttpClientBuilder.create().build();
              URL sessionURL = new URL("http://" + hostName + ":" + port + "/grid/api/testsession?session=" + session);
              BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest("POST", sessionURL.toExternalForm());
              CloseableHttpResponse response = client.execute(host, r);
              JSONObject object = extractObject(response);
              URL myURL = new URL(object.getString("proxyId"));
              if ((myURL.getHost() != null) && (myURL.getPort() != -1)) {
                  node = new RemoteNodeInformation(myURL.getHost(), myURL.getPort());
              }
          } catch (Exception e) {
              logger.log(Level.FINE, errorMsg, e);
              // Just log the exception at finer level but dont throw any exceptions
              // because this is just value added information.
          }
          logger.exiting(node);
          return node;
      }
docs: For a given Session ID against a host on a particular port, this method returns the remote webdriver node and the
  port to which the execution was redirected to by the hub.
  
  @param hostName
  The name of the hub machine
  @param port
  The port on which the hub machine is listening to
  @param session
  An object of type {@link SessionId} which represents the current session for a user.
  @return An array of string wherein the first element represents the remote node's name and the second element
  represents its port. May return <code>null</code> on error.