SOCKS server life-cycle: detailed definitions and unit tests for onceStarted and onceStopped promises

The general idea here is that the SOCKS server depends on two things to function:

* TCP server
* peerconnection

Once both have successfully started, the SOCKS server is running (`onceStarted`); conversely, once _either_ dies, the SOCKS server has died (`onceStopped`).

This defines `onceStarted` and `onceStopped` reasonably concretely and adds unit tests for how they should behave. Those tests are obviously pretty abstract so this pull request has a number of TODOs marking where integration tests are required, e.g. verify peerconnection's `onceDisconnected` actually fires and that its `stop` method is idempodent.

Tested with the sample apps.

Clearly, a followup pull request would implement a similar lifecycle for SOCKS sessions which depend on both a TCP connection and data channel to function.
If we are testing that `stop` is called, we have to be making the call that that is part of the specification (We definitely shouldn't be minimizing our mocks at the expense of testing things that we don't want to be true!). Generally, that's not good style for a specification to test behaviour instead of state. How about adding a function call to actually get the connection state, e.g. `isReady() : boolean`. Then we check the value of isReady?