title: Why Google Recaptcha returns false after a specific time in java?
body: <p>I am using Google <code>reCAPTCHA</code> in my project. It works fine. But after a specific time, my code is returning the response value is false. It should be true.
  <strong>Not always</strong> like this, but after 10 days(for example) returning false.I am not hitting any daily usage limit.</p>
  
  <p>The problem is solving when I restart the server (apache tomcat).<br>
  <strong>My code is:</strong> </p>
  
  <pre><code>public static boolean verify(String gRecaptchaResponse) throws IOException {
      if (gRecaptchaResponse == null || "".equals(gRecaptchaResponse)) {
          return false;
      } 
      try { 
      URL obj = new URL(url);
      HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
  
      // add reuqest header
      con.setRequestMethod("POST");
      con.setRequestProperty("User-Agent", USER_AGENT);
      con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
  
      String postParams = "secret=" + secret + "&amp;response="
              + gRecaptchaResponse;
  
      // Send post request
      con.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(con.getOutputStream());
      wr.writeBytes(postParams);
      wr.flush();
      wr.close();
  
      int responseCode = con.getResponseCode();
      System.out.println("\nSending 'POST' request to URL : " + url);
      System.out.println("Post parameters : " + postParams);
      System.out.println("Response Code : " + responseCode);
  
      BufferedReader in = new BufferedReader(new InputStreamReader(
              con.getInputStream()));
      String inputLine;
      StringBuffer response = new StringBuffer();
  
      while ((inputLine = in.readLine()) != null) {
  
          response.append(inputLine);
      }
      in.close();
  
      // print result
      System.out.println(response.toString());
  
      //parse JSON response and return 'success' value
      JsonReader jsonReader = Json.createReader(new StringReader(response.toString()));
      JsonObject jsonObject = jsonReader.readObject();
      jsonReader.close();
  
      return **jsonObject.getBoolean("success");**
      } catch(Exception e){
          e.printStackTrace();
          return false;
      }
  }
  </code></pre>