code: public static boolean match(Cookie cookie, String protocol, String host, String path) {
          if (cookie.secure() && !protocol.equalsIgnoreCase("https")) {
              return false;
          }
  
          // check domain
          if (isIP(host) || cookie.hostOnly()) {
              if (!host.equals(cookie.domain())) {
                  return false;
              }
          } else {
              if (!Cookies.isDomainSuffix(host, cookie.domain())) {
                  return false;
              }
          }
  
          String cookiePath = cookie.path();
          // check path
          if (cookiePath.length() > path.length()) {
              return false;
          }
          if (cookiePath.length() == path.length()) {
              return cookiePath.equals(path);
          }
          if (!path.startsWith(cookiePath)) {
              return false;
          }
          if (cookiePath.charAt(cookiePath.length() - 1) != '/' && path.charAt(cookiePath.length()) != '/') {
              return false;
          }
          return true;
      }
docs: If cookie match the given scheme, host, and path.
  
  @param host should be lower case