private Handler<HttpConnection> connectionHandler() {

    return connection -> {
      if (activeConnectionsCount.get() >= maxActiveConnections) {
        // disallow new connections to prevent DoS
        LOG.warn(
            "Rejecting new connection from {}. Max {} active connections limit reached.",
            connection.remoteAddress(),
            activeConnectionsCount.getAndIncrement());
        connection.close();
      } else {
        LOG.debug(
            "Opened connection from {}. Total of active connections: {}/{}",
            connection.remoteAddress(),
            activeConnectionsCount.incrementAndGet(),
            maxActiveConnections);
      }
      connection.closeHandler(
          c ->
              LOG.debug(
                  "Connection closed from {}. Total of active connections: {}/{}",
                  connection.remoteAddress(),
                  activeConnectionsCount.decrementAndGet(),
                  maxActiveConnections));
    };
  }
Construct a EngineJsonRpcService to handle either http or websocket clients

@param vertx The vertx process that will be running this service
@param dataDir The data directory where requests can be buffered
@param config Configuration for the rpc methods being loaded
@param metricsSystem The metrics service that activities should be reported to
@param natService The NAT environment manager.
@param methods The json rpc methods that should be enabled
@param maybeSockets websocket configuration to use
@param scheduler for managing ETH tasks
@param authenticationService used to grant or deny access to methods served
@param livenessService A service responsible for reporting whether this node is live
@param readinessService A service responsible for reporting whether this node has fully started
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/EngineJsonRpcService.java