handle runtime errors
Retry connect if error is a conection refused or time out