Bug fixes to test-server Python response hook support.

* correctly fake a package to hold all the response-hook modules
* use StringIO correctly in the response hooks
* prevent .py(c) files in test/www/ from being accessed directly
* prevent test/www/__init__ from being treated as a response hook
* add a test case that makes sure the existing hooks _can_ return 200 OK

(issue #12439; buggy commit 4d60e94)
Set SO_REUSEADDR on the test server's listening port.

This means you don't have to wait 30 seconds in between invocations of
run-tests.py.

Also, if the test server fails to bind its port, print the actual
OS-level error message rather than guessing what the problem is.

issue #12439
Speed-up the tests by reducing some time-outs.

Running all tests should finish in 22 seconds instead of 41 seconds.

https://github.com/ariya/phantomjs/issues/12439
Port the user agent test.

https://github.com/ariya/phantomjs/issues/12439