   ([host protocol]
      (format "%s://%s:%s%s" protocol host (http-port) (context-path))))
 
-(defn in-cluster?
+(let [in-cluster (delay
+                   (boolean
+                     (ignore-load-failures
+                       (-> ^Class (u/try-import 'org.projectodd.wunderboss.as.ClusterUtils)
+                         (.getMethod "inCluster" nil)
+                         (.invoke nil nil)))))]
+  (defn in-cluster?
   "Returns true if running inside a cluster"
   []
-  @in-cluster)
+  @in-cluster))

  []
  (= "EAP" @container-type)))

(let [streaming-supported? (delay (invoke-as-util-method "isAsyncStreamingSupported"))]
  (defn async-streaming-supported?
  "Returns true if the container supports async HTTP stream sends."
  []
  ;; the delay returns an instance of Boolean, but not Boolean/TRUE or
  ;; Boolean/FALSE for some reason, so we have to coerce it to a
  ;; boolean primitive for clojure to be happy and treat false as false
  (boolean @streaming-supported?)))

(defn messaging-remoting-port
  "Returns the port that HornetQ is listening on for remote connections"

  (partial port :http))

(defn- invoke-as-util-method [^String method]
  (ignore-load-failures
    (-> ^Class (u/try-import 'org.projectodd.wunderboss.as.ASUtils)
      (.getMethod method nil)
      (.invoke nil nil))))

(let [container-type (delay (invoke-as-util-method "containerTypeAsString"))]
  (defn in-eap?
