Added a try-catch to the WebSocket transport send.

- This helps catch errors that can be thrown from a websocket being in an invalid state.
- Also added a test to verify that we catch errors thrown by a socket send.

#2582
Ensure the fail handler on hub invocations gets triggered

- Previously if you invoked a hub method while the WebSocket transport
  was in in the reconnecting state, it would throw.

#2582
Making the variable declarations in pingServer somewhat readable