Work in progress - implement running a server in a separate thread.
Fix readHeader with malformed input.

Currently crashes during pool cleanup, so not finished.