 
 (extend-protocol ISend
   String
-  (send [data ^Response response]
-    (.send response data))
+  (send [data ^Context ctx]
+    (let [^Response response (.getResponse ctx)]
+      (.send response data)))
 
   clojure.core.async.impl.channels.ManyToManyChannel
-  (send [data ^Response response]
+  (send [data ^Context ctx]
     (-> (stream/publisher data)
-        (send response)))
+        (send ctx)))
 
   manifold.stream.default.Stream
-  (send [data ^Response response]
+  (send [data ^Context ctx]
     (-> (stream/publisher data)
-        (send response)))
+        (send ctx)))
 
   futura.promise.Promise
-  (send [data ^Response response]
+  (send [data ^Context ctx]
     (-> (stream/publisher data)
-        (send response)))
+        (send ctx)))
 
   manifold.deferred.IDeferred
-  (send [data ^Response response]
+  (send [data ^Context ctx]
     (-> (stream/publisher data)
-        (send response)))
+        (send ctx)))
 
   CompletableFuture
-  (send [data ^Response response]
+  (send [data ^Context ctx]
     (-> (stream/publisher data)
-        (send response)))
+        (send ctx)))
 
   Publisher
-  (send [data ^Response response]
-    (->> (stream/publisher (map helpers/bytebuffer) data)
-         (.sendStream response)))
+  (send [data ^Context ctx]
+    (let [^Response response (.getResponse ctx)]
+      (->> (stream/publisher data)
+           (stream/transform (map helpers/bytebuffer))
+           (.stream ctx)
+           (.sendStream response))))
 
   InputStream
-  (send [data ^Response response]
+  (send [data ^Context ctx]
     (let [^bytes buffer (byte-array 1024)
-          ^ByteBuf buf (Unpooled/buffer (.available data))]
+          ^ByteBuf buf (Unpooled/buffer (.available data))
+          ^Response response (.getResponse ctx)]
       (loop [index 0]
         (let [readed (.read data buffer 0 1024)]
           (when-not (= readed -1)

(extend-protocol IHandlerResponse
  String
  (handle-response [data ^DefaultContext context]
    (let [response (:response context)]
      (send data response)))

  clojure.lang.IPersistentMap
  (handle-response [data ^DefaultContext context]
    (let [^Response response (:response context)
          {:keys [status headers body]} data]
      (when status
        (.status response ^long status))
      (when headers
        (set-headers* response headers))
      (send body response)))

  catacumba.impl.http.Response
  (handle-response [data ^DefaultContext context]
    (let [^Response response (:response context)]
      (.status response ^long (:status data))
      (set-headers* response (:headers data))
      (send (:body data) response)))

  clojure.core.async.impl.channels.ManyToManyChannel
  (handle-response [data ^DefaultContext context]
    (let [^Response response (:response context)]
      (.status response 200)
      (send data response)))

  manifold.stream.default.Stream
  (handle-response [data ^DefaultContext context]
    (let [^Response response (:response context)]
      (.status response 200)
      (send data response)))

  Publisher
  (handle-response [data ^DefaultContext context]
    (let [^Response response (:response context)]
      (.status response 200)
      (send data response)))

  futura.promise.Promise
  (handle-response [data ^DefaultContext context]
    (let [^Response response (:response context)]
      (.status response 200)
      (send data response)))

  CompletableFuture
  (handle-response [data ^DefaultContext context]


(defmethod send! DefaultContext
  [^DefaultContext context data]
  (send data (:catacumba/context context)))

(defmulti adapter
  "A polymorphic function for create the
