Exit heartbeat goroutine when socket is closed.
Trying to detect dead socket as soon as possible.
Expect to get message at least once in each HartbeatTimeout.
Raise timeout error if that fails.
Allow client to close connection. Implementing Close on Socket.