View Source TestServer.HTTPServer behaviour (TestServer v0.1.16)

HTTP server adapter module.

Usage

defmodule MyApp.MyHTTPServer do
  @behaviour TestServer.HTTPServer

  @impl true
  def start(instance, port, scheme, tls_options, server_options) do
    # ...
  end

  def stop(instance, server_options) do
    # ...
  end

  def get_socket_pid(conn) do
    # ...
  end
end

Summary

Types

@type instance() :: pid()
@type options() :: [tls: keyword(), ipfamily: :inet | :inet6]
@type port_number() :: :inet.port_number()
@type scheme() :: :http | :https
@type server_options() :: keyword()

Callbacks

@callback get_socket_pid(Plug.Conn.t()) :: pid()
Link to this callback

start(instance, port_number, scheme, options, server_options)

View Source
@callback start(instance(), port_number(), scheme(), options(), server_options()) ::
  {:ok, pid(), server_options()} | {:error, any()}
Link to this callback

stop(instance, server_options)

View Source
@callback stop(instance(), server_options()) :: :ok | {:error, any()}