 
 
 (defn close-client [{:keys [group channel-f]}]
-  (-> ^ChannelFuture channel-f ^Channel .channel .closeFuture))
+  (if channel-f
+    (-> ^ChannelFuture channel-f ^Channel .channel .closeFuture)))
 
 (defn close-all [{:keys [group] :as conf}]
   (close-client conf)
-  (-> group .shutdownGracefully .sync))
+  (if group
+    (-> group .shutdownGracefully .sync)))
 
 
 (defn client-handler [{:keys [group read-ch error-ch write-ch]}]

         g (NioEventLoopGroup.)
         conf {:group g :write-ch write-ch :read-ch read-ch :error-ch error-ch :handlers handlers}
         client (start-client host port conf) ]

    ;async read off error-ch
    (go 
      (loop [local-client client]

                              v1) ;else return the value (this is c, the connection)
                            )))]
                      
                      (if (and (instance? FailedWrite o) c)
                        (do 
                            (info "retry failed write: ")
                            (<! (timeout 500))
