Improve pool connection error handling

* retry connecting, don't fail forever
* retry in any case if no working connection is available
* return a timeout if there are no connections that are working or can be
  retried
* move randMember to utils