code: private boolean isNonProxyHost(String host, String nonProxyHosts) {
          if (host == null || nonProxyHosts == null) {
              return false;
          }
  
          // construct pattern
          StringBuilder patternBuilder = new StringBuilder();
          for (int i = 0; i < nonProxyHosts.length(); i++) {
              char c = nonProxyHosts.charAt(i);
              switch (c) {
              case '.':
                  patternBuilder.append("\\.");
                  break;
              case '*':
                  patternBuilder.append(".*");
                  break;
              default:
                  patternBuilder.append(c);
              }
          }
          // check whether the host is the nonProxyHosts.
          String pattern = patternBuilder.toString();
          return host.matches(pattern);
      }
docs: Returns true if the {@code nonProxyHosts} system property pattern exists
  and matches {@code host}.