       ^Bootstrap (.handler ^ChannelInitializer (client-channel-initializer conf)))
     (let [ch-f (.connect b)]
       (.sync ch-f)
-      (->Client g ch-f write-ch read-ch internal-error-ch error-ch (AtomicInteger.) (AtomicBoolean. false))))
+      (->Client g ch-f write-ch read-ch internal-error-ch error-ch reconnect-count closed)))
   (catch Exception e (do
                        (.printStackTrace e)
                        (error (str "Error starting client " e) e)
                        (>!! internal-error-ch [e nil])
-                       ))))
+                       )))))
     
 (defn read-print-ch [n ch]
   (go 

                          ))))


(defn start-client [host port {:keys [group read-ch internal-error-ch error-ch write-ch handlers] :as conf 
                                 :or {group (NioEventLoopGroup.) 
                                      read-ch (chan 100) internal-error-ch (chan 100) error-ch (chan 100) write-ch (chan 100)}}]
  "Start a Client instance with read-ch, write-ch and internal-error-ch"
  (try

         internal-error-ch (chan error-buff)
         error-ch (chan error-buff)
         g (NioEventLoopGroup.)
         conf {:group g :write-ch write-ch :read-ch read-ch :internal-error-ch internal-error-ch :error-ch error-ch :handlers handlers
               :reconnect-count (AtomicInteger.) :closed (AtomicBoolean. false)}
         client (start-client host port conf) ]
    
    (if (not client)
