         :inet.setopts(sock, [active: :once])
         {:noreply, %{state | state: :auth}}
       {:error, _} ->
+        Logger.error "Instrumental authentication failure"
         {:noreply, %{state | state: :auth}, @auth_retry}
     end
   end

  end

  def handle_info({:tcp_closed, sock}, %{sock: sock} = state) do
    Logger.debug "Instrumental disconnected"
    {:noreply, %{state | sock: nil, state: nil}, @connect_retry}
  end

  def handle_info(:timeout, %{sock: nil}) do
    Logger.debug "Connecting to instrumental"
    case connect() do
      {:ok, sock} ->
        Logger.debug "Instrumental connected"
        {:noreply, %State{sock: sock}, 0}
      _error ->
        {:noreply, %State{}, @connect_retry}
    end
  end

        :inet.setopts(sock, [active: :once])
        {:noreply, %{state | sock: sock, state: :hello}}
      {:error, _} ->
        Logger.error "Failed to send hello to instrumental"
        {:noreply, state, @auth_retry}
    end
  end
