Maybe you can use:
which is called when there's incoming message from server.
So you may initiate connection, and if over the period of 5 seconds you have received response: it means connection was successful. If there was no response in 5 seconds: you know that connection has failed.