Move state management outside error_wait.

It was a code smell at the time which the writing of tests has flushed
out. Also necessitated a small interface change which allows the
callback to always get called, useful for testing and logging I imagine.
Only expect HTTP URI instances.
Added Interface & Example to README.

It could do with some more detail still.