function createRedirectServer () {
    var server;

    server = http.createServer(function (req, res) {
        var hops,
            data = '';

        // path: /{n}
        if ((/^\/\d+$/).test(req.url)) {
            hops = parseInt(req.url.substring(1), 10) - 1;

            // redirect until all hops are covered
            res.writeHead(302, {
                location: hops > 0 ? `/${hops}` : '/'
            });

            return res.end();
        }
        // path: /status/<responseCode>
        else if ((/^\/status\/(\d{3})$/).test(req.url)) {
            res.writeHead(parseInt(req.url.substr(-3), 10), { location: '/' });

            return res.end();
        }

        req.on('data', function (d) { data += d; });

        req.once('end', function () {
            res.writeHead(200, { connection: 'close', 'Content-Type': 'application/json' });
            res.end(JSON.stringify({
                url: req.url,
                method: req.method,
                headers: req.headers,
                data: data
            }));
        });
    });

    server.on('listening', function () {
        server.port = this.address().port;
    });

    enableServerDestroy(server);

    return server;
}
Redirect + Echo Server
 - Follows specified redirects -> /<redirects-count>
 - Redirects with specified response code -> /status/<response-code>
 - Echos final request URL, Method, Headers and Body

@example
var s = createRedirectServer();

s.listen(3000, function() {
  console.log(s.port);
  s.close();
});