anchor.diff:  
   -type connection_type() :: http | https.
   
  +-type open_opts() ::
  +        #{
  +            transport_opts => [],
  +            timeout => pos_integer() | infinity }.
  +%% transport_opts are passed to Ranch's TCP transport, which is -itself- a thin layer over gen_tcp. <br/>
  +%% timeout is passed to gun:await_up. Default if not specified is 5000 ms.
   
   %% @doc Starts the application and all the ones it depends on.
   -spec start() -> {ok, [atom()]}.
  
positive.code:     application:stop(shotgun).
  
  %% @private
  -spec start_link(string(), integer(), connection_type()) ->
      {ok, pid()} | ignore | {error, term()}.
  start_link(Host, Port, Type) ->
      gen_fsm:start_link(shotgun, [Host, Port, Type], []).
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% API
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  %% @equiv get(Host, Port, http)
  -spec open(Host :: string(), Port :: integer()) -> {ok, pid()}.
  open(Host, Port) ->
      open(Host, Port, http).
  
  %% @doc Opens a connection of the type provided with the host in port specified.
  -spec open(Host :: string(), Port :: integer(), Type :: connection_type()) ->
      {ok, pid()}.
  open(Host, Port, Type) ->
      supervisor:start_child(shotgun_sup, [Host, Port, Type]).
  
  
  %% @doc Closes the connection with the host.
  -spec close(pid()) -> ok.
  
negative.code: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  %% @private
  -spec init([term()]) -> {ok, at_rest, map()} | {stop, gun_open_timeout} | {stop, gun_open_failed}.
  init([Host, Port, Type, Opts]) ->
      GunType = case Type of
                    http -> tcp;
                    https -> ssl
                end,
      TransportOpts = maps:get(transport_opts, Opts, []),
      GunOpts = #{transport      => GunType,
                  retry          => 1,
                  retry_timeout  => 1,
                  transport_opts => TransportOpts
                 },
      Timeout = maps:get(timeout, Opts, 5000),
      {ok, Pid} = gun:open(Host, Port, GunOpts),
      case gun:await_up(Pid, Timeout) of
        {ok, _} ->
          State = clean_state(),
          {ok, at_rest, State#{pid => Pid}};
        %The only apparent timeout for gun:open is the connection timeout of the
        %underlying transport. So, a timeout message here comes from gun:await_up.
        {error, timeout} ->
          {stop, gun_open_timeout};
        %gun currently terminates with reason normal if gun:open fails to open
        %the requested connection. This bubbles up through gun:await_up.
        {error, normal} ->
          {stop, gun_open_failed}
      end.
  
  %% @private
  -spec handle_event(term(), atom(), term()) -> term().
  