   containing :id, :host and :port values."
   ^CopycatServer
   [log id port remote-nodes]
-  (let [local-member (-> (NettyMember/builder)
+  (let [local-member (-> (Member/builder)
                          (.withId id)
                          (.withHost (-> (java.net.InetAddress/getLocalHost)
                                         (.getHostName)))
                          (.withPort port)
                          .build)
-        remote-members (map #(-> (NettyMember/builder)
+        remote-members (map #(-> (Member/builder)
                                  (.withId (:id %))
                                  (.withHost (:host %))
                                  (.withPort (:port %))
                                  .build)
                             remote-nodes)
-        cluster-members (conj remote-members local-member)
-        cluster (-> (NettyCluster/builder)
-                    (.withMemberId id)
-                    (.withMembers cluster-members)
+        all-members (conj remote-members local-member)
+        members (-> (Members/builder)
+                    (.withMembers all-members)
                     (.build))
+        transport (.build (NettyTransport/builder))
         server (-> (CopycatServer/builder)
-                   (.withCluster cluster)
+                   (.withTransport transport)
+                   (.withMemberId id)
+                   (.withMembers members)
                    (.withLog log)
                    (.build)
                    (.open)

  "Returns a CopycatClient for the given nodes. Nodes should be a seq of maps containing :id, :host and :port values."
  ^CopycatClient
  [nodes]
  (let [cluster-members (map #(-> (NettyMember/builder)
                                  (.withId (:id %))
                                  (.withHost (:host %))
                                  (.withPort (:port %))
                                  .build)
                             nodes)
        cluster (-> (NettyMembers/builder)
                    (.withMembers cluster-members)
                    (.build))
        client (-> (CopycatClient/builder)
                   (.withMembers cluster)
                   (.build)
                   (.open)

(ns figaro.core
    "A sweet Clojure API for Copycat"
  (:import (net.kuujo.copycat Copycat CopycatClient CopycatServer)
           (net.kuujo.copycat.raft Members Member)
           (net.kuujo.copycat.io.transport NettyTransport)
           (net.kuujo.copycat.io.storage Log StorageLevel)
           (net.kuujo.copycat.atomic DistributedAtomicValue)))

(defn mem-log
  "Creates an in memory log."
