   @moduletag :integration
 
   setup_all do
-    {:ok, pid} = PusherClient.connect!('ws://localhost:8080/app/app_key')
-    info = PusherClient.client_info(pid)
-    {:ok, [gen_event_pid: info.gen_event_pid, pid: pid]}
+    {:ok, pid} = PusherClient.start_link('ws://localhost:8080/app/app_key')
+    {:ok, [pid: pid]}
   end
 
   teardown_all context do

  end

  defmodule EchoHandler do
    use GenEvent.Behaviour
    def init(pid), do: { :ok, pid }
    def handle_event(event, pid) do
      send pid, event

  end

  test "subscribe on a public channel", context do
    pid = context[:pid]

    PusherClient.add_handler(pid, EchoHandler)
    PusherClient.subscribe!(pid, "channel")

    assert_receive {"channel", "pusher:subscription_succeeded", %{}}, 5_000
  end
end
