   use GenServer
   require Logger
   alias AmqpOne.Transport.Socket
+  alias AmqpOne.Transport.Frame
 
   @type perf_t :: :open | :begin | :attach | :flow | :transfer |
   :disposition | :detch | :end | :close

  Encodes the internal representation of a frame to a proper
  binary encoded AMQP 1.0 frame
  """
  @spec encode_frame(%Frame{}, non_neg_integer) :: binary
  def encode_frame(frame, channel) when is_integer(channel) and channel < 65636 do
    payload = :erlang.term_to_binary(frame)
    << 2 :: integer,

    |> Keyword.put(:packet, 0)
    {:ok, pid} = GenServer.start_link(__MODULE__, [host, port, [:binary | opts], socket_mod], [])
    GenServer.call(pid, {:connect})
    GenServer.call(pid, {:open})
    pid
  end

