<commit_before>
'use strict';

const assert = require('assert');
const Koa = require('../../');
const net = require('net');

describe('res.writable', () => {
  describe('when continuous requests in one persistent connection', () => {
    function requestTwice(server, done){
      const port = server.address().port;
      const buf = new Buffer('GET / HTTP/1.1\r\nHost: localhost:' + port + '\r\nConnection: keep-alive\r\n\r\n');
      const client = net.connect(port);
      const datas = [];
      client
        .on('error', done)
        .on('data', data => datas.push(data))
        .on('end', () => done(null, datas));
      setImmediate(() => client.write(buf));<commit_msg>test: Buffer() is deprecated due to security and usability issues. so use the Buffer.alloc() instead (#1321)<commit_after>
'use strict';

const assert = require('assert');
const Koa = require('../../');
const net = require('net');

describe('res.writable', () => {
  describe('when continuous requests in one persistent connection', () => {
    function requestTwice(server, done){
      const port = server.address().port;
      const buf = Buffer.from('GET / HTTP/1.1\r\nHost: localhost:' + port + '\r\nConnection: keep-alive\r\n\r\n');
      const client = net.connect(port);
      const datas = [];
      client
        .on('error', done)
        .on('data', data => datas.push(data))
        .on('end', () => done(null, datas));
      setImmediate(() => client.write(buf));
{'fraction_non_alphanumeric': 0.1910958904109589, 'fraction_numerical': 0.005479452054794521, 'mean_word_length': 3.1742857142857144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5799945', 'n_tokens_mistral': 451, 'n_tokens_neox': 434, 'n_words': 115}