I'm developing an application on spring boot, however I needed to integrate recaptcha for security purposes on various forms, however the connection always results in a connection timed out, I verified api and the url with postman and it goes through and returns an answer, however on Java code times run out and I get the error java.net.ConnectException: Connection timed out: connect
I don't know what I'm doing wrong I use the postman code that provides on "Java OK HTTP". code is the next one.
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.google.com/recaptcha/api/siteverify?secret=XX&response=XXX")
.get()
.addHeader("cache-control", "no-cache")
.addHeader("postman-token", "f47548e1-a9e0-9065-7f76-dced294bddcb")
.build();
Response response = client.newCall(request).execute();
However I don't seem to get where the error is, can someone help me?