   (let [{:keys [host port timeout]} server
         socket (Socket. #^String host #^Integer port)]
     (doto socket
+      (.setSoTimeout timeout)
       (.setTcpNoDelay true)
       (.setKeepAlive true))))
 

(defn- trim [#^String s] (.trim s))
(defn- parse-int [#^String s] (Integer/parseInt s))
(defn- char-array [len] (make-array Character/TYPE len))

(def *default-host* "127.0.0.1")
(def *default-port* 6379)
(def *default-db* 0)
(def *default-timeout* 5) 


(defstruct server :host :port :db :timeout :socket)

(def *server* (struct-map server
                :host     *default-host*
                :port     *default-port*
                :db       *default-db*
                :timeout  *default-timeout* ;; not yet used
                :socket   nil))

(defn connect-to-server
  "Create a Socket connected to server"

;;
;; Reply dispatching
;;
(defn reply-type
  ([#^BufferedReader reader]
     (char (.read reader))))
