The session's connection lifecycle: opening the transport, reacting to what it reports, tearing it down and deciding when to try again.
Everything here runs inside the session process — the worker calls these
functions, so the transport is linked to it, Process.monitor/1 registers the
monitor against it and timers fire back into its mailbox, exactly as when this
code sat in ExWapp.Session.Worker. Nothing is moved to another process; only
the code moved out of the module.
Teardown is deliberately tolerant: a disconnect cancels timers, drains pending callers and stops child processes, and each of those steps has to run even if an earlier one found nothing to clean up.