        (.build))))
 
 (def ^:private regular-scheme-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" (PlainConnectionSocketFactory/getSocketFactory))
-      (.register "https" secure-ssl-socket-factory)
-      (.build)))
+  (delay (-> (RegistryBuilder/create)
+             (.register "http" (PlainConnectionSocketFactory/getSocketFactory))
+             (.register "https" @secure-ssl-socket-factory)
+             (.build))))
 
 (def ^:private regular-strategy-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" NoopIOSessionStrategy/INSTANCE)
-      (.register "https" secure-strategy)
-      (.build)))
+  (delay (-> (RegistryBuilder/create)
+             (.register "http" NoopIOSessionStrategy/INSTANCE)
+             (.register "https" @secure-strategy)
+             (.build))))
 
 (defn ^Registry get-custom-scheme-registry
   [{:keys [context verifier]}]

                             (opt req :insecure)
                             @insecure-strategy-registry

                             :else regular-strategy-registry)
        io-reactor (make-ioreactor {:shutdown-grace-period 1})]
    (doto (PoolingNHttpClientConnectionManager. io-reactor registry)
      (.setMaxTotal 1))))

     (SSLIOSessionStrategy. ^SSLContext context ^HostnameVerifier verifier))))

(def ^:private ^SSLConnectionSocketFactory secure-ssl-socket-factory
  (delay (SSLConnectionSocketFactory/getSocketFactory)))

(def ^:private ^SSLIOSessionStrategy secure-strategy
  (delay (SSLIOSessionStrategy/getDefaultStrategy)))

(defn ^SSLConnectionSocketFactory SSLGenericSocketFactory
  "Given a function that returns a new socket, create an
