private static boolean isBindException(Exception cmdLineException) {
    if (cmdLineException == null) {
      return false;
    }
    if (cmdLineException instanceof BindException) {
      return true;
    }
    if (
      cmdLineException.getCause() != null && cmdLineException.getCause() instanceof BindException
    ) {
      return true;
    }
    return false;
  }
@param protocolPortClash This param is just so we can manufacture a port clash so we can test
                         the code does the right thing when this happens during actual test
                         runs. Ugly but works.
@see TestBindExceptionHandling#testProtocolPortClash()
hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerCmdLine.java