Refactor HTTP server listen