title: Check if Selenium Hub/Node are running on a given port
body: <p>I want to check whether Selenium Hub or Node is running on a particular port (ex:- 5555). I already have the code to check whether a particular port is free or not. But I am not sure how to find out the application using the port.</p>
  
  <pre><code>if (Port is free)
      i=1
  else if (Port is used as Selenium Hub)
      i=2
  else if (Port is used as Selenium Node)
      i=3
  else if (Port is used by apps other than Selenium)
      i=4
  else
      i=5
  </code></pre>
  
  <p>Please let me know if this can be done using java.</p>