                :repl-options {:input-stream r-is :output-stream r-os})
         repl-cfg {:host (repl/repl-host project)
                   :port (repl/repl-port project)}
-        repl-server-port (repl/server project repl-cfg false)
-        repl-client-thread (Thread. (fn [] (repl/client project repl-server-port) ))          
+        ;repl-server-port (repl/server project repl-cfg false)
+        repl-server (nrepl.server/start-server :port 59258)
+        ;repl-client-thread (Thread. (fn [] (repl/client project repl-server-port) ))
+        repl-connection (nrepl/connect :port 59258)
+        repl-client (nrepl/client repl-connection Long/MAX_VALUE)
         #_(lein-main/apply-task "repl" project [])
         #_(apply eval/eval-in-project project
                            (server-forms project cfg (ack-port project)

            (when (= (.getKeyCode e) java.awt.event.KeyEvent/VK_ENTER)
              (.append textArea "\n")
              ;; This shouldn't be here:
              (text! (:text-area @repl-output-window) (.toString (get-repl-outputstream)))
              (try 
                (let [startPosition 0
                      line (.getText textArea startPosition (- (.getLength (.getDocument textArea)) startPosition 1))
                      session-sender (nrepl/client-session @reply.eval-modes.nrepl/current-connection :session @reply.eval-modes.nrepl/current-session)]
                  (.setText textArea "")
                  (println "Sending to repl:" line)
                  (session-sender {:op "eval" :code line :id (nrepl.misc/uuid)})
                  #_(reply.eval-modes.nrepl/execute-with-client (:client @repl) #_@reply.eval-modes.nrepl/current-connection
                             (assoc {}
                                    :read-input-line-fn (partial reply.reader.simple-jline/safe-read-line {:no-jline true :prompt-string ""})                                                          

    [leiningen.core.eval :as eval]
    [leiningen.core.main :as lein-main])
  (:use [clojure.java.io :only [file]] 
        [clojure.pprint]
        [seesaw core font color graphics]))

;; ## Globals
