function createServerAndMakeRequest({ url, expectedData, plan, app, pkgVersion }) {
  let requestListener = app

  // connect < v2 was a different module
  // you had to manually call app.handle
  if (semver.satisfies(pkgVersion, '<2')) {
    requestListener = function (req, res) {
      app.handle(req, res)
    }
  }

  const server = http.createServer(requestListener).listen(0, function () {
    const req = http.request(
      {
        port: server.address().port,
        host: 'localhost',
        path: url,
        method: 'GET'
      },
      function onResponse(res) {
        res.on('data', function (data) {
          plan.equal(data.toString(), expectedData, 'should respond with proper data')
        })
      }
    )
    req.end()
  })

  return server
}
Sets up HTTP server and binds a connect instance
It then makes a request to specified url and asserts the response
data is correct

@param {Object} params
@param {string} params.url url to make request
@param {string} params.expectedData expected response data
@param {Object} app connect app

@param params.plan
@param params.app
@param params.pkgVersion
@returns {http.Server}