add retries to reconnect
added test
Merge pull request #1 from backupify/retry-reconnects

add retries to reconnect