Use timers for heartbeats

This reduces the number of threads used by the client.

Patch from Grégoire Seux.
.
Adapt this test since connections now use less memory
merge bug26459 into default