Refactor state machine contexts into an interface

This allows for nested states such as the operational super state to
allow for a hierarchical (sp?) state machine's behaviour.

Updated the state base to include its context for all states so that
they may access and operate on it freely. Cleaned up prosthesis state
method signatures to an implicit context from its constructor instead of
a context passed in by its events.

Added a cursory wait for success of the self test state. Currently
doesn't do anything once it has elapsed.

Cleaned up exception handling for TCP server in the case a connection
has been disposed and it is accessing the socket.