code: public int getPort()
      {
          if (_port > 0) return _port;
          if (_host != null) return 0;
          if (_uri.isAbsolute())
              _port = _uri.getPort();
          else if (_connection != null) _port = _connection.getServerPort();
          return _port;
      }
docs: Get the request port. The port is obtained either from an absolute URI, the HTTP Host header
  field, the connection or the default.
  
  @return The port. 0 should be interpreted as the default port.