Handle connection timeouts

If a thread doesn't return in 4 seconds, but isn't complete (slow server, for instance), return error.