code: protected boolean tomcatIsRunning()  {
  
          CloseableHttpClient client= HttpClients.createDefault();
          CloseableHttpResponse response = null;
  
          try {
              HttpGet httpget = new HttpGet("http://localhost:" + getPort() + "/alfresco");
              response = client.execute(httpget);
              getLog().info("Tomcat is running on port "+ getPort());
              return true;
  
          } catch (Exception ex) {
              getLog().info("Tomcat is not running on port " + getPort() );
              return false;
          }
  
      }
docs: Check if Tomcat is already running.
  
  @return <code>true</code> if Tomcat is already running, <code>false</code> otherwise