function _createServer(path, port, createCompleteCallback) {
    var server,
        app,
        address,
        pathKey = getPathKey(path);

    // create a new map for this server's requests
    _requests[pathKey] = {};

    function requestRoot(server, cb) {
        address = server.address();

        // Request the root file from the project in order to ensure that the
        // server is actually initialized. If we don't do this, it seems like
        // connect takes time to warm up the server.
        var req = http.get(
            {host: address.address, port: address.port},
            function (res) {
                cb(null, res);
            }
        );
        req.on("error", function (err) {
            cb(err, null);
        });
    }

    function rewrite(req, res, next) {
        var location = {pathname: parse(req).pathname},
            hasListener = _rewritePaths[pathKey] && _rewritePaths[pathKey][location.pathname],
            requestId = _filterRequestCounter++,
            timeoutId;

        // ignore most HTTP methods and files that we're not watching
        if (("GET" !== req.method && "HEAD" !== req.method) || !hasListener) {
            next();
            return;
        }

        // pause the request and wait for listeners to possibly respond
        var pause = utils.pause(req);

        function resume(doNext) {
            // delete the callback after it's used or we hit the timeout.
            // if this path is requested again, a new callback is generated.
            delete _requests[pathKey][requestId];

            // pass request to next middleware
            if (doNext) {
                next();
            }

            pause.resume();
        }

        // map request pathname to response callback
        _requests[pathKey][requestId] = function (resData) {
            // clear timeout immediately when this callback is called
            clearTimeout(timeoutId);

            // response data is optional
            if (resData.body) {
                // HTTP headers
                var type    = mime.lookup(location.pathname),
                    charset = mime.charsets.lookup(type);

                res.setHeader("Content-Type", type + (charset ? "; charset=" + charset : ""));

                // TODO (jasonsanjose): off-by-1 error here, why?
                // Chrome seems to handle the request without issues when Content-Length is not specified
                //res.setHeader("Content-Length", Buffer.byteLength(resData.body /* TODO encoding? */));

                // response body
                res.end(resData.body);
            }

            // resume the HTTP ServerResponse, pass to next middleware if
            // no response data was passed
            resume(!resData.body);
        };

        location.hostname = address.address;
        location.port = address.port;
        location.root = path;

        var request = {
            headers:    req.headers,
            location:   location,
            id:         requestId
        };

        // dispatch request event
        _domainManager.emitEvent("staticServer", "requestFilter", [request]);

        // set a timeout if custom responses are not returned
        timeoutId = setTimeout(function () { resume(true); }, _filterRequestTimeout);
    }

    app = connect();
    app.use(rewrite);
    // JSLint complains if we use `connect.static` because static is a
    // reserved word.
    app.use(connect["static"](path, { maxAge: STATIC_CACHE_MAX_AGE }));
    app.use(connect.directory(path));

    server = http.createServer(app);

    // Once the server is listening then verify we can handle requests
    // before calling the callback
    server.on("listening", function () {
        requestRoot(
            server,
            function (err, res) {
                if (err) {
                    createCompleteCallback("Could not GET root after launching server", null);
                } else {
                    createCompleteCallback(null, server);
                }
            }
        );
    });

    // If the given port/address is in use then use a random port
    server.on("error", function (e) {
        if (e.code === "EADDRINUSE") {
            server.listen(0, "127.0.0.1");
        } else {
            throw e;
        }
    });

    server.listen(port, "127.0.0.1");
}
@private
Helper function to create a new server.
@param {string} path The absolute path that should be the document root
@param {function(?string, ?httpServer)} cb Callback function that receives
   an error (or null if there was no error) and the server (or null if there
   was an error).