docs: private static void matchIp(String expectedIP, X509Certificate cert)
                      throws CertificateException {
          Collection<List<?>> subjectAlternativeNames = cert.getSubjectAlternativeNames();
          if (subjectAlternativeNames == null) {
              throw new CertificateException("No subject alternative names present");
          }
          List<String> nonMatchingIpAltnames = new LinkedList<>();
          for (List<?> san : subjectAlternativeNames) {
              if (((Integer) san.get(0)).intValue() != ALTNAME_IP) {
                  continue;
              }
              String ipAddress = (String) san.get(1);
              if (expectedIP.equalsIgnoreCase(ipAddress)) {
                  return;
              }
              else {
                  try {
                      // See if the addresses match if we transform then, useful for IPv6 addresses
                      if (InetAddress.getByName(expectedIP).equals(InetAddress.getByName(ipAddress))) {
                          // expectedIP matches the given ipAddress, return
                          return;
                      }
                  }
                  catch (UnknownHostException | SecurityException e) {
                      LOGGER.log(Level.FINE, "Comparing IP strings failed", e);
                  }
              }
              nonMatchingIpAltnames.add(ipAddress);
          }
          StringBuilder sb = new StringBuilder("No subject alternative names matching IP address "
                          + expectedIP + " found. Tried: ");
          for (String s : nonMatchingIpAltnames) {
              sb.append(s).append(',');
          }
          throw new CertificateException(sb.toString());
      }