Put Connection state variables into TVars

Other:

  * Handle IO exceptions in receive
  * TLS initialization