spring-bootarmeria

Armeria WebClient request with connection factory and Req header


I have been trying to make an https connection using armeria WebClient Since the connection factory is not specified I am getting javax.net.ssl.SSLHandshakeException could anyone help with a relevant example.? Thanks


Solution

  •   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();
    }