I am trying to integrate the Mollie payment service ( http://www.mollie.nl ), which works with HTTPS requests in the Java environment.
Regarding these posts, I will use the following query to explain: In PHP (since I have a PHP background), I can work with cURL:
$ curl -X GET https://api.mollie.nl/v1/methods \
-H "Authorization: Bearer API-KEY"
Who has the answer:

Testing REQUEST from DHC (or Postman) returns the correct answer.

So, in Java, I use the Jersey library to try to access the request:
Client client = Client.create();
WebResource webResource = client.resource("https://api.mollie.nl/v1/methods");
webResource.header("Authorization", "Bearer API-KEY");
ClientResponse response = webResource
.header("Content-Type", "application/json;charset=UTF-8")
.type("application/json")
.accept("application/json")
.get(ClientResponse.class);
int statusCode = response.getStatus();
if (statusCode == 401) {
throw new AuthenticationException("Invalid Username or Password");
}
String responseCall = response.getEntity(String.class);
When Java code is executed, the request throws a ClientHandlerException:
HTTP Status 500 - com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection timed out: connect
I am running a Java test from a local Apache server. But I can’t understand why the Java request gives a timeout, as the authentication header seems to be correct (at least for me).
, , - https://api.mollie.nl/v1/methods, .
.
- ?
!