dakrone / clj-http

An idiomatic clojure http client wrapping the apache client. Officially supported version.
http://clojars.org/clj-http
MIT License
1.78k stars 408 forks source link

Async connection manager doesn't support Keystore. #572

Closed gitankitsingh closed 3 years ago

gitankitsingh commented 3 years ago
;; Having a reusable connection manage with a keystore like this 
(def cm (conn-mgr/make-reusable-conn-manager {:timeout           100
                                              :threads           10 
                                              :default-per-route 10
                                              :keystore          "keystore.jks"
                                              :keystore-pass     "pass"}))

;; and then making a request like this works. 
(http/post url {:connection-manager cm})

but when using the async connection manager by using make-reusable-async-conn-manager to create a new async connection manager, it throws an exception while making the request with the created async connection manager.

(http/post url {:connection-manager cm
                :async? true})

"class org.apache.http.conn.ssl.SSLConnectionSocketFactory cannot be cast to class org.apache.http.nio.conn.SchemeIOSessionStrategy (org.apache.http.conn.ssl.SSLConnectionSocketFactory and org.apache.http.nio.conn.SchemeIOSessionStrategy are in unnamed module of loader 'app')

rymndhng commented 3 years ago

Ah good find! I was able to reproduce this locally.

It appears the Async Connection Manager is mistakingly using the non-Async Registry builder which causes this issue.