var express = require('express')
var app = express()
var http = require('http')
var https = require('https')
var fs = require('fs')
var options = {
  key: fs.readFileSync(__dirname + '/key.pem'),
  cert: fs.readFileSync(__dirname + '/key-cert.pem')
}
var httpServer = http.createServer(app)
var httpsServer = https.createServer(options, app)
var getChar = function* () {
  var char = 0
  while (true) {
    yield char
    char = char === 9 ? 0 : char + 1
  }
}
app
  .use('/files', express.static(__dirname + '/files'))
  .get('/chunk/:size.txt', function (req, res) {
    var count = 0,
      size = parseInt(req.params.size),
      char = getChar()
    while (count < size) {
      res.write(char.next().value.toString())
      count++
    }
    res.send()
  })
  .get('/range/:size.txt', function (req, res) {
    var count = 0,
      str = '',
      size = parseInt(req.params.size),
      char = getChar()
    while (count < size) {
      str += char.next().value.toString()
      count++
    }
    res.send(str)
  })

const startServer = (app, port) => new Promise(i => {
  const onClose = () => new Promise(i => server.close(i))
  const onStart = () => i(onClose)
  const server = app.listen(port, onStart)
})

exports.http = (port) => startServer(httpServer, port)
exports.https = (port) => startServer(httpsServer, port)

@@ -339,133 +339,12 @@
 pp)%0A
-var getChar = function* () %7B%0A  var char = 0%0A  while (true) %7B%0A    yield char%0A    char = char === 9 ? 0 : char + 1%0A  %7D%0A%7D
 %0Aapp
-%0A  
 .use
@@ -395,511 +395,8 @@
 s'))
-%0A  .get('/chunk/:size.txt', function (req, res) %7B%0A    var count = 0,%0A      size = parseInt(req.params.size),%0A      char = getChar()%0A    while (count %3C size) %7B%0A      res.write(char.next().value.toString())%0A      count++%0A    %7D%0A    res.send()%0A  %7D)%0A  .get('/range/:size.txt', function (req, res) %7B%0A    var count = 0,%0A      str = '',%0A      size = parseInt(req.params.size),%0A      char = getChar()%0A    while (count %3C size) %7B%0A      str += char.next().value.toString()%0A      count++%0A    %7D%0A    res.send(str)%0A  %7D)
 %0A%0Aco

remove unused modules from test server