public static boolean checkSecurityInfos(String endpoint,Identity clientIdentity,List<SecurityInfo> securityInfos){
  if (clientIdentity.isSecure()) {
    if (securityInfos == null || securityInfos.isEmpty()) {
      LOG.warn("Client '{}' without security info try to connect through the secure endpoint",endpoint);
      return false;
    }
 else {
      for (      SecurityInfo securityInfo : securityInfos) {
        if (checkSecurityInfo(endpoint,clientIdentity,securityInfo)) {
          return true;
        }
      }
      return false;
    }
  }
 else   if (securityInfos != null && !securityInfos.isEmpty()) {
    LOG.warn("Client '{}' must connect using DTLS",endpoint);
    return false;
  }
  return true;
}

public static boolean checkSecurityInfos ( String endpoint , Identity clientIdentity , List < SecurityInfo > securityInfos ) { if ( clientIdentity . isSecure ( ) ) { if ( securityInfos == null || securityInfos . isEmpty ( ) ) { LOG . warn ( "Client '{}' without security info try to connect through the secure endpoint" , endpoint ) ; return false ; } else { for ( SecurityInfo securityInfo : securityInfos ) { if ( checkSecurityInfo ( endpoint , clientIdentity , securityInfo ) ) { return true ; } } return false ; } } else if ( securityInfos != null && ! securityInfos . isEmpty ( ) ) { LOG . warn ( "Client '{}' must connect using DTLS" , endpoint ) ; return false ; } return true ; }
return true if any of the securityinfos is valid for the given endpoint and client identity .
