0

我一直在尝试使用 armeria 建立 https 连接WebClient由于未指定连接工厂,我得到javax.net.ssl.SSLHandshakeException任何人都可以提供相关示例的帮助。?谢谢

4

1 回答 1

0
  RequestHeaders header = RequestHeaders.of(HttpMethod.GET, endpoint, HttpHeaderNames.COOKIE,
            cookieHeader);
    WebClient.of(clientFactory(), hosturl)
    .execute(header)
    .aggregate()
    .whenCompleteAsync((resp,cause)->{
        if(cause != null) {
           //TODO
        }
        else if(resp.status()==HttpStatus.OK) {
            //TODO
        }
        else
        {
            //TODO
        }


    });




 public static ClientFactory clientFactory() {

    return ClientFactory.builder().sslContextCustomizer(b -> b.trustManager(InsecureTrustManagerFactory.INSTANCE))
            .idleTimeout(Duration.ZERO).build();
}
于 2020-04-06T07:08:19.033 回答