public WebSocketConfiguration webSocketConfiguration(
      final List<String> hostsAllowlist, final String defaultHostAddress, final Long wsTimoutSec) {
    final WebSocketConfiguration webSocketConfiguration = WebSocketConfiguration.createDefault();
    webSocketConfiguration.setEnabled(isRpcWsEnabled);
    webSocketConfiguration.setHost(
        Strings.isNullOrEmpty(rpcWsHost) ? defaultHostAddress : rpcWsHost);
    webSocketConfiguration.setPort(rpcWsPort);
    webSocketConfiguration.setMaxFrameSize(rpcWsMaxFrameSize);
    webSocketConfiguration.setMaxActiveConnections(rpcWsMaxConnections);
    webSocketConfiguration.setRpcApis(rpcWsApis);
    webSocketConfiguration.setRpcApisNoAuth(
        rpcWsApiMethodsNoAuth.stream().distinct().collect(Collectors.toList()));
    webSocketConfiguration.setAuthenticationEnabled(isRpcWsAuthenticationEnabled);
    webSocketConfiguration.setAuthenticationCredentialsFile(rpcWsAuthenticationCredentialsFile);
    webSocketConfiguration.setHostsAllowlist(hostsAllowlist);
    webSocketConfiguration.setAuthenticationPublicKeyFile(rpcWsAuthenticationPublicKeyFile);
    webSocketConfiguration.setAuthenticationAlgorithm(rpcWebsocketsAuthenticationAlgorithm);
    webSocketConfiguration.setTimeoutSec(wsTimoutSec);
    webSocketConfiguration.setSslEnabled(isRpcWsSslEnabled);
    webSocketConfiguration.setKeyStorePath(rpcWsKeyStoreFile);
    webSocketConfiguration.setKeyStoreType(rpcWsKeyStoreType);
    webSocketConfiguration.setClientAuthEnabled(isRpcWsClientAuthEnabled);
    webSocketConfiguration.setTrustStorePath(rpcWsTrustStoreFile);
    webSocketConfiguration.setTrustStoreType(rpcWsTrustStoreType);
    webSocketConfiguration.setKeyPath(rpcWsKeyFile);
    webSocketConfiguration.setCertPath(rpcWsCertFile);
    webSocketConfiguration.setTrustCertPath(rpcWsTrustCertFile);

    if (keystorePasswordOptions != null) {
      webSocketConfiguration.setKeyStorePassword(keystorePasswordOptions.rpcWsKeyStorePassword);
      webSocketConfiguration.setKeyStorePasswordFile(
          keystorePasswordOptions.rpcWsKeystorePasswordFile);
    }

    if (truststorePasswordOptions != null) {
      webSocketConfiguration.setTrustStorePassword(
          truststorePasswordOptions.rpcWsTrustStorePassword);
      webSocketConfiguration.setTrustStorePasswordFile(
          truststorePasswordOptions.rpcWsTruststorePasswordFile);
    }

    return webSocketConfiguration;
  }
Creates a WebSocket configuration based on the WebSocket options.

@param hostsAllowlist List of allowed hosts
@param defaultHostAddress Default host address
@param wsTimoutSec WebSocket timeout in seconds
@return WebSocketConfiguration instance
app/src/main/java/org/hyperledger/besu/cli/options/RpcWebsocketOptions.java