When I create requests for http
it works with this:
ClientResource resource = new ClientResource(protocol + "://localhost:" + port + path);
However when I create https
requests I get that error:
Starting the internal [HTTPS/1.1] server on port 8081
Starting the internal HTTP client
A recoverable error was detected (1001), attempting again in 2000 ms.
A recoverable error was detected (1001), attempting again in 2000 ms.
Stopping the internal server
I know that when we use Client
object we should set that:
Client client = new Client(Protocol.HTTPS);
So, I am suspicious about setting something like that for ClientResource
. I tried that but didn't solve:
resource.setProtocol(Protocol.HTTPS);
Also tried that:
Client client = new Client(Protocol.HTTPS);
resource.setProtocol(Protocol.HTTPS);
resource.setNext(client);
However I got the same logs. As you can see from logs, it first creates an HTTPS server but HTTP client.
Any ideas?
Problem was related to certificates. I've set a trust keystore and used it for my example.