Compare with CUPS' own socket backend: if httpAddrConnect() fails, it acts as follows:
1. If CLASS environment variable is set, sleep 5 seconds and exit with CUPS_BACKEND_FAILED.
2. Otherwise, for ECONNREFUSED, EHOSTDOWN and EHOSTUNREACH, retry after 5 seconds (backing off to 30 seconds)
3. For other errors, retry after 30 seconds
4. Give up after a week (adjustable with URI option 'contimeout')
Here's a patch to take the CLASS environment variable into account.