/** Select IOP profile that matches protocol */
  public Profile selectProfile(List profiles, ClientConnectionManager ccm) {
    final Iterator iter = profiles.iterator();

    while (iter.hasNext()) {
      final Profile profile = (Profile) iter.next();
      final int profileTag = profile.tag();

      for (int i = 0; i < protocols.length; i++) {
        final int tagToMatch = protocols[i].protocol_type;

        if (profileTag == tagToMatch) {
          return profile;
        }

        if (profileTag == TAG_INTERNET_IOP.value && profile instanceof IIOPProfile) {
          // Special case check for IIOP profile supporting SSL
          IIOPProfile iiopProfile = (IIOPProfile) profile;
          if ((tagToMatch == ORBConstants.JAC_SSL_PROFILE_ID) && (iiopProfile.getSSL() != null)) {
            return profile;
          }

          // Special case check for IIOP profile not supporting SSL
          if ((tagToMatch == ORBConstants.JAC_NOSSL_PROFILE_ID)
              && ((iiopProfile.getSSL() == null)
                  ||
                  // SSL port contains a valid value but further check is required
                  // see if protection is enabled.
                  (((iiopProfile.getSSL()).target_requires & org.omg.Security.NoProtection.value)
                      != 0))) {
            return profile;
          }
        }
      }
    }

    return null;
  }