           (.removeServiceListener mdns-service reg-type service-listener)
           (.close mdns-service))))))
 
+(defn resolve-bonjour [bonjour-name timeout]
+  (let [reg-type "_http._tcp.local."
+        mdns-service (JmDNS/create)]
+    (try
+      (let [info (.getServiceInfo mdns-service reg-type bonjour-name timeout)]
+        (when info
+          {:address (.getAddress info)
+           :port    (.getPort info)}))
+      (finally
+        (future
+          (.close mdns-service))))))
+
 (defn socket [host port]
   (let [socket (Socket. host port)
         in     (io/reader socket)

      (tear-down repl-env)
      (throw t))))

(defrecord JscEnv [socket response-promise webdav-mount-point options]
  repl/IReplEnvOptions
  (-repl-options [this]
    {:require-foreign true})

    (tear-down repl-env)))

(defn repl-env* [options]
  (JscEnv. (atom nil) (atom nil) (atom nil) (atom nil) options))

(defn repl-env
  [& {:as options}]
