             [clj-http.util :refer [opt]]
             [clojure.pprint])
   (:import (java.io FilterInputStream InputStream)
+           (java.net URI)
+           (java.util Locale)
            (org.apache.http HttpHost)
            (org.apache.http.client.methods HttpGet)
            (org.apache.http.client.protocol HttpClientContext)

(defn http-get []
  (HttpGet. "https://www.google.com"))

(defn http-context []
  (HttpClientContext/create))


            (.close response)
            (.shutdown conn-mgr)))))))

(defn request
  [{:keys [body
           cookie-store
           multipart
           request-method
           scheme
           server-name
           server-port
           request-method
           query-string
           uri]
    :as req}]
  (let [scheme (name scheme)
        http-url (str scheme "://" server-name
                      (when server-port (str ":" server-port))
                      uri
                      (when query-string (str "?" query-string)))
        conn-mgr (pooling-conn-mgr)
        client (http-client conn-mgr)
        context (http-context)
        http-req (http-request-for request-method http-url body)]
    (when cookie-store
      (.setCookieStore context cookie-store))
    (if multipart
      (.setEntity ^HttpEntityEnclosingRequest http-req
                  (mp/create-multipart-entity multipart))
      (when (and body (instance? HttpEntityEnclosingRequest http-req))
        (if (instance? HttpEntity body)
          (.setEntity ^HttpEntityEnclosingRequest http-req body)
          (.setEntity ^HttpEntityEnclosingRequest http-req
                      (if (string? body)
                        (StringEntity. ^String body "UTF-8")
                        (ByteArrayEntity. body))))))
    (let [response (.execute client http-req context)
          entity (.getEntity response)
          status (.getStatusLine response)]
      {:body (coerce-body-entity entity conn-mgr response)
       :length (.getContentLength entity)
       :chunked? (.isChunked entity)
       :repeatable? (.isRepeatable entity)
       :streaming? (.isStreaming entity)
       :status (.getStatusCode status)})))
