Is this what you're looking for?
You can access the initial session through ((HornetQConnection)conn).getInitialSession()
Client Pinging will close the connection if for some reason the server is down.
Or just create an ExceptionListener using the JMS API - this will get called if there is a problem with the connection, and just maintain a flag "alive" in your own application.
This is the proper, and portable way to do it with JMS.
That´s the way I found to do it.