   "Create a Socket proxied through socks, using the given hostname and port"
   [^String hostname ^Integer port]
   (Socket. (Proxy. Proxy$Type/SOCKS (InetSocketAddress. hostname port))))
-
-(defn make-socks-proxied-conn-manager
-  "Given an optional hostname and a port, create a connection manager that's
-  proxied using a SOCKS proxy."
-  [^String hostname ^Integer port]
-  (let [socket-factory #(socks-proxied-socket hostname port)
-        reg (-> (RegistryBuilder/create)
-                (.register "http" (PlainGenericSocketFactory socket-factory))
-                (.register "https" (SSLGenericSocketFactory socket-factory))
-                (.build))]
-    (PoolingHttpClientConnectionManager. reg)))
-
-(def insecure-scheme-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" PlainConnectionSocketFactory/INSTANCE)
-      (.register "https" insecure-socket-factory)
-      (.build)))
-
-(def insecure-strategy-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" NoopIOSessionStrategy/INSTANCE)
-      (.register "https" insecure-strategy)
-      (.build)))
-
-(def regular-scheme-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" (PlainConnectionSocketFactory/getSocketFactory))
-      (.register "https" secure-ssl-socket-factory)
-      (.build)))
-
-(def regular-strategy-registry
-  (-> (RegistryBuilder/create)
-      (.register "http" NoopIOSessionStrategy/INSTANCE)
-      (.register "https" secure-strategy)
-      (.build)))
 
 (defn ^KeyStore get-keystore*
   [keystore-file keystore-type ^String keystore-pass]

     :verifier (if (opt req :insecure)
                 NoopHostnameVerifier/INSTANCE
                 (DefaultHostnameVerifier.))}))

(defn ^Registry get-keystore-scheme-registry
  [req]

(defn ^SSLConnectionSocketFactory SSLGenericSocketFactory
  "Given a function that returns a new socket, create an
  SSLConnectionSocketFactory that will use that socket."
  ([socket-factory] (SSLGenericSocketFactory socket-factory (SSLContexts/createDefault)))
  ([socket-factory ^SSLContext ssl-context]
   (proxy [SSLConnectionSocketFactory] [ssl-context]
     (connectSocket [timeout socket host remoteAddress localAddress context]
       (let [^SSLConnectionSocketFactory this this] ;; avoid reflection
         (proxy-super connectSocket timeout (socket-factory) host remoteAddress
                      localAddress context))))))

(defn ^PlainConnectionSocketFactory PlainGenericSocketFactory
  "Given a Function that returns a new socket, create a
