Is there a good way to detect temporary connection loss and attempt to reconnect maybe a predefined number of times? I am trying to use Hammerdb for Postgres sending couple of queries to a read replica which sometimes restarts under certain conditions and I want to continue the test by retrying a few times.