gabrielfalcao/HTTPretty — pull request #166 by chris-martin (2014-05-20 01:23:46+00:00)
Title: Make tests behave nicely when server startup fails

Two issues:

- In JSONEchoServer, lock.release() wasn't called in a finally block, so an exception raised from server startup resulted in deadlock.

- If a server fails to start, its client blocks indefinitely waiting for it to respond. Solution is to set a timeout so it can give up after a while.

An easy way to reproduce the issues being fixed here is to bind port 8888 with anything and then run the tests, so the server will fail to start because its port is already in use.