monkey-patch select, thread and time

To avoid blocking on connection errors, retries and I/O
delays.