2016-08-23 35 views
0

請求時,我創建http請求它的工作原理與此:HTTPS與ClientResource

ClientResource resource = new ClientResource(protocol + "://localhost:" + port + path); 

然而,當我創建https請求我得到這個錯誤:

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 

我知道,當我們使用Client我們應該設定的對象:

Client client = new Client(Protocol.HTTPS); 

所以,我很懷疑爲ClientResource設置類似的東西。我試過,但沒有解決:

resource.setProtocol(Protocol.HTTPS); 

也試過了:

Client client = new Client(Protocol.HTTPS); 
resource.setProtocol(Protocol.HTTPS); 
resource.setNext(client); 

但是我得到了相同的日誌。從日誌中可以看到,它首先創建一個HTTPS服務器,但是HTTP客戶端。

任何想法?

回答

0

問題與證書有關。我設置了一個信任密鑰庫,並將其用於我的示例。