Move to single-threaded server implementation

This moves to a single-threaded, custom-implemented server instead of
using the SocketServer. This allows more flexible handling, and creation
of a STSession class which can be used by both clients and servers.

TODO: There's no error handling at the moment, IOErrors get thrown but
not handled