# `ExMoQ.Testing.Relay`
[🔗](https://github.com/membraneframework/ex_moq_relay/blob/v0.1.0/lib/ex_moq/testing/relay.ex#L1)

A relay for ExUnit tests, reached over TCP and stopped with the test.

    %ExMoQ.Relay.Info{tcp: url} = ExMoQ.Testing.Relay.start_supervised!()

To stop it before the test ends, start it with ExUnit directly:

    relay = start_supervised!({ExMoQ.Relay, ExMoQ.Testing.Relay.options()}, id: :relay)
    ExMoQ.Relay.info(relay).tcp
    stop_supervised!(:relay)

# `free_port`

```elixir
@spec free_port() :: :inet.port_number()
```

A TCP port nothing listens on right now, for a relay to bind.

# `options`

```elixir
@spec options(Path.t() | nil) :: ExMoQ.Relay.options()
```

Options for a test relay: TCP only, on a port that is free as they are built.

# `start_supervised!`

```elixir
@spec start_supervised!(Path.t() | nil) :: ExMoQ.Relay.Info.t()
```

Starts a relay with `options/1` under the test supervisor and blocks until
it is ready.

Raises if there is no binary, or the relay exits or is not ready in time.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
