For better encapsulation around connection events
(e.g. device being authenticated and identified), moved
more of the connection logic into the session object.
Also, refine how connections are handled so they are properly
deregistered once a client closes a connection.
Depends on D7799