add websocket client test & fix sockjs API

Fixes:

- This change make sure that we can close the loop when finishing the
application: the session cleanup loop & stats aggregations aren't
blocking anymore.
- Pass headers as latin1 (http spec)
- Graceful shutdown of the client is now optional and disabled by
  default.