Add support for localhost URLs

Also added a timeout to the Mocha test