   def recv({:ok, conn}, fun), do: recv(conn, fun)
   def recv(%Conn{socket: {:gen_tcp, socket}, timeout: timeout} = conn, fun) do
     receive do
+      {:xmlstreamelement, stanza} ->
+        fun.(conn, stanza)
       {:tcp, ^socket, data} ->
         :ok = activate({:gen_tcp, socket})
         {:ok, conn, stanza} = parse_data(conn, data)

        {:xmlstreamelement, stanza}      -> stanza
      end

    Logger.debug fn -> "[#{jid}][INCOMING] #{inspect stanza}" end
    #Logger.debug fn -> "[#{jid}][INCOMING] #{inspect data}" end

    if send_to_owner do
      Kernel.send(owner, {:stanza, stanza})

  end
  def recv(%Conn{socket: {:ssl, socket}, timeout: timeout} = conn, fun) do
    receive do
      {:xmlstreamelement, stanza} ->
        fun.(conn, stanza)
      {:ssl, ^socket, data} ->
        :ok = activate({:ssl, socket})
        {:ok, conn, stanza} = parse_data(conn, data)
