            (java.nio.charset Charset)
            (java.net InetSocketAddress)
            (java.io IOException))
-  (:require [clojure.core.async :as async :refer [go go-loop >! <! <!! >!! chan]]))
+  (:require [clojure.core.async :as async :refer [go go-loop >! <! <!! >!! chan]]
+            [clojure.string :as string :refer [join split]]))
 
 ;; concept...
 ;; every view gets an in-port and an out-port

            SelectionKey/OP_ACCEPT
            (accept-connection server-socket selector)
            SelectionKey/OP_READ
            (read-socket k)))
        (.clear selected-keys)))))


(defn run [router & {:keys [ip port]
                     :or {ip "0.0.0.0" port 8080}}]
  (apply react (setup port)))


;; what I want to do:

      (.configureBlocking false)
      (.register selector SelectionKey/OP_READ))))


(defn header-string-to-keyword [header-string]
  (keyword (.trim (.toLowerCase header-string))))

(defn parse-header [header]
  (let [bits (seq (.split header "\\s*:\\s*"))]
    [(header-string-to-keyword (first bits)) (second bits)])) ;; TODO: I want to use symbols for the header names...

(defn parse-headers [header-lines]
  "Returns a map of keyword -> string value"
  (if header-lines
    (apply array-map (apply concat (map parse-header header-lines)))
    {}))

(defn parse-request [request-string]
