Make the rest adapter respect port configuration

Fix #307 by changing 'host' to 'hostname' dynamically, thus making url.format include port.