code: private static int portStringToInt(String value) {
          int port;
          try {
              port = Integer.parseInt(value);
          } catch (NumberFormatException e) {
              throw new HAProxyProtocolException("invalid port: " + value, e);
          }
  
          if (port <= 0 || port > 65535) {
              throw new HAProxyProtocolException("invalid port: " + value + " (expected: 1 ~ 65535)");
          }
  
          return port;
      }
docs: Convert port to integer
  
  @param value                      the port
  @return                           port as an integer
  @throws HAProxyProtocolException  if port is not a valid integer