chrishunt/hi — pull request #5 by chrishunt (2013-12-29 20:13:38+00:00)
Title: Use random port if port already in use

Fixes #4

If the requested port is in use, then try a random port between 1000 and 10,000. After 5 failed attempts to start the server, we'll raise `Hi::Server::CantStartServerError` with a description message.

```bash
Starting server on port 3000...

>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop

Unable to start server, trying random port instead.
Starting server on port 4434...

>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4434, CTRL+C to stop
```

cc @yelinaung