anchor.diff:      request.response.headers.contentType = type;
     }
     if (response != null) {
  -    request.response.write(response);
  +    var data = encodeUtf8(response);
  +    request.response.contentLength = data.length;
  +    request.response.add(data);
  +  } else {
  +    request.response.contentLength = 0;
     }
     request.response.close();
   }
  
positive.code:     })
    ]).then((_) {
      HttpServer.bind(address, port).then((server) {
        server.listen((request) {
          switch (request.uri.path) {
            case '/':
              _jsonTest(request);
              break;
            case '/db':
              _dbTest(request);
              break;
            case '/fortunes':
              _fortunesTest(request);
              break;
            case '/update':
              _updateTest(request);
              break;
            case '/plaintext':
              _plaintextTest(request);
  
negative.code:   _sendJson(request, { 'message': 'Hello, World!' });
  }
  
  _queryRandom() {
    return _connectionPool.connect()
        .then((connection) {
          return connection.query(
              'SELECT id, randomNumber FROM world WHERE id = @id;',
              { 'id': _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1 })
              //
              // The benchmark's constraints tell us there is exactly one row.
              //
              .single
              .then((row) => new World(row[0], row[1]))
              .whenComplete(() { connection.close(); });
        });
  }
  
  /// Responds with the database query test to the [request].
  _dbTest(request) {
    _queryRandom().then((response) => _sendJson(request, response));
  }
  
  /// Responds with the database queries test to the [request].
  _queriesTest(request) {
    var queries = _parseInt(request.uri.queryParameters['queries']).clamp(1, 500);
    Future.wait(new List.generate(queries,
                                  (_) => _queryRandom(),
                                  growable: false))
        .then((response) => _sendJson(request, response));
  }
  
  /// Responds with the fortunes test to the [request].
  _fortunesTest(request) {
    _connectionPool.connect().then((connection) {
      return connection.query('SELECT id, message FROM fortune;')
          .map((row) => new Fortune(row[0], row[1]))
          .toList()
          .whenComplete(() { connection.close(); });
    }).then((fortunes) {
      fortunes.add(new Fortune(0, 'Additional fortune added at request time.'));
      fortunes.sort();
      _sendHtml(request, _fortunesTemplate.renderString({
  