       (.withReconnectionPolicy builder reconnection-policy))
     (when load-balancing-policy
       (.withLoadBalancingPolicy builder load-balancing-policy))
+    (when compression
+      (.withCompression (select-compression compression)))
     (when ssl
       (.withSSL builder (build-ssl-options ssl)))
     (when ssl-options

           ssl
           ssl-options
           kerberos
           protocol-version]}]
  (when force-prepared-queries
    (alter-var-root (var hayt/*prepared-statement*)
                    (constantly true)))

    (.init ssl-context (.getKeyManagers keymanager) (.getTrustManagers trustmanager) nil)
    (SSLOptions. ssl-context ssl-cipher-suites)))

(defn- ^ProtocolOptions$Compression select-compression
  [compression]
  (case compression
    :snappy ProtocolOptions$Compression/SNAPPY
    :lz4 ProtocolOptions$Compression/LZ4
    ProtocolOptions$Compression/NONE))

(defn ^Session connect
  "Connects to the Cassandra cluster. Use `build-cluster` to build a cluster."
  ([hosts]
