Add connection testing & retry logic to pool

Hi Gary,

Here's a better pull request, with docs and logging removed.

This adds connection testing and retry logic when retrieving a connection from the pool.

m