COMETD-482 - Implement hook for transport failures.

 Implementation for BayeuxClient.
Guarding against NPE when calling close() if the connection has not been opened.
 COMETD-482 - Implement hook for transport failures.

 Implementation for the JavaScript client.