code: static InetAddress determineClientAddress(HttpHeaders headers,
                                                List<ClientAddressSource> clientAddressSources,
                                                @Nullable ProxiedAddresses proxiedAddresses,
                                                InetAddress remoteAddress,
                                                Predicate<InetAddress> filter) {
          for (final ClientAddressSource source : clientAddressSources) {
              final InetAddress addr;
              if (source.isProxyProtocol()) {
                  if (proxiedAddresses != null) {
                      addr = ((InetSocketAddress) proxiedAddresses.sourceAddress()).getAddress();
                      if (filter.test(addr)) {
                          return addr;
                      }
                  }
              } else {
                  final AsciiString name = source.header();
                  if (name.equals(HttpHeaderNames.FORWARDED)) {
                      addr = getFirstValidAddress(
                              headers.get(HttpHeaderNames.FORWARDED), FORWARDED_CONVERTER, filter);
                  } else {
                      addr = getFirstValidAddress(headers.get(name), Function.identity(), filter);
                  }
                  if (addr != null) {
                      return addr;
                  }
              }
          }
          // We do not apply the filter to the remote address.
          return remoteAddress;
      }
docs: Returns an {@link InetAddress} of a client who initiated a request.
  
  @param headers the HTTP headers which were received from the client
  @param clientAddressSources a list of {@link ClientAddressSource}s which are used to determine
  where to look for the client address, in the order of preference
  @param proxiedAddresses source and destination addresses retrieved from PROXY protocol header
  @param remoteAddress a remote endpoint of a channel
  @param filter the filter which evaluates an {@link InetAddress} can be used as a client address
  @see <a href="https://tools.ietf.org/html/rfc7239">Forwarded HTTP Extension</a>
  @see <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For">X-Forwarded-For</a>