Pick a random port if the default one is in use.

This enables the use of multiple instances at the same time, and properly
select which one to connect to.