title: Clojure Java interop issues when connecting to WAMP API
body: <p>I'm currently trying to connect to a WAMP API using Clojure's Java interop on <a href="https://github.com/angiolep/akka-wamp/" rel="nofollow noreferrer">akka-wamp</a>. I'm trying, specifically, to "Clojurize" this <a href="https://github.com/angiolep/akka-wamp/blob/master/examples/poloniex/src/main/java/PoloniexJavaClient.java" rel="nofollow noreferrer">Java client</a>. I've built up the threaded expression gradually and the <code>.connect</code> returned a Java Future, which on <code>deref</code> returned a <code>akka.wamp.client.japi.Connection</code>. When I add the <code>(reify ...)</code> for the Consumer callback, I don't get anything back if I <code>deref</code> the returned Future (REPL just hangs). I can ping the API successfully, but not sure if that is sufficient to say it's working. Please can someone help me fill in the gaps in my interop? The more detailed the better as I'm really keen to learn.</p>
  
  <p>My code so far is:</p>
  
  <pre><code>(ns poloniex.core
    (:import [akka.actor ActorSystem]
             [akka.wamp.client.japi Client Connection]
             [java.util.function Consumer])
    (:gen-class))
  
  (def actor-system (ActorSystem/create))
  (def client (Client/create actor-system))
  
  (-&gt; client 
      (.connect "wss://api.poloniex.com" "json") 
      (.thenAccept 
        (reify Consumer 
          (accept [this conn] 
            (.open conn "realm1"))))
      (.thenAccept 
        (reify Consumer 
          (accept [this session] 
            (.subscribe session "BTC_XMR"
                                (reify Consumer 
                                  (accept [this event]
                                    (println (.kwargs event) (.args event)))))))))
  </code></pre>
  
  <p>For anyone wanting to attempt to replicate, my project.clj is as follows:</p>
  
  <pre><code>(defproject poloniex "0.1.0-SNAPSHOT"
    :description "FIXME: write description"
    :url "http://example.com/FIXME"
    :license {:name "Eclipse Public License"
              :url "http://www.eclipse.org/legal/epl-v10.html"}
    :dependencies [[org.clojure/clojure "1.8.0"]
                   [com.github.angiolep/akka-wamp_2.12 "0.15.0"]
                   [com.typesafe.akka/akka-actor_2.12 "2.5.1"]
                   [org.scala-lang/scala-library "2.12.2"]
                   [com.typesafe.akka/akka-remote_2.12 "2.5.1"]
                   [com.typesafe.akka/akka-kernel_2.12 "2.5-M1"]
                   [com.typesafe.akka/akka-stream_2.12 "2.5.1"]]
    :main ^:skip-aot poloniex.core
    :target-path "target/%s"
    :profiles {:uberjar {:aot :all}})
  </code></pre>
  
  <p>I've recently found a Clojure library that connects to the Poloniex API (<a href="https://github.com/adambober/clojure-poloniex" rel="nofollow noreferrer">clojure-poloniex</a>) that uses a different Java library, but I'm keen to understand what I'm doing wrong and how I can fix it.</p>