Prevent connection "freezes" in WebSockets

- A healthy socket can become corrupted after a JSON serialization error
- If the socket isn't closed by the server, the client will miss  all messages
  including keep-alives causing the connection to freeze until it times out.
- By closing the socket on the server, the client will reconnect immediately

#2800
Tests to ensure that forever transports are closed on write failure

#2800