11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst http = require('http');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci{
71cb0ef41Sopenharmony_ci  const server = http.createServer(common.mustCall((req, res) => {
81cb0ef41Sopenharmony_ci    res.end('asd');
91cb0ef41Sopenharmony_ci  }));
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci  server.listen(0, common.mustCall(() => {
121cb0ef41Sopenharmony_ci    http.get({
131cb0ef41Sopenharmony_ci      port: server.address().port
141cb0ef41Sopenharmony_ci    }, common.mustCall((res) => {
151cb0ef41Sopenharmony_ci      assert.strictEqual(res.destroyed, false);
161cb0ef41Sopenharmony_ci      res.destroy();
171cb0ef41Sopenharmony_ci      assert.strictEqual(res.destroyed, true);
181cb0ef41Sopenharmony_ci      res.on('close', common.mustCall(() => {
191cb0ef41Sopenharmony_ci        server.close();
201cb0ef41Sopenharmony_ci      }));
211cb0ef41Sopenharmony_ci    }));
221cb0ef41Sopenharmony_ci  }));
231cb0ef41Sopenharmony_ci}
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci{
261cb0ef41Sopenharmony_ci  const server = http.createServer(common.mustCall((req, res) => {
271cb0ef41Sopenharmony_ci    res.end('asd');
281cb0ef41Sopenharmony_ci  }));
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci  server.listen(0, common.mustCall(() => {
311cb0ef41Sopenharmony_ci    http.get({
321cb0ef41Sopenharmony_ci      port: server.address().port
331cb0ef41Sopenharmony_ci    }, common.mustCall((res) => {
341cb0ef41Sopenharmony_ci      assert.strictEqual(res.destroyed, false);
351cb0ef41Sopenharmony_ci      res.on('close', common.mustCall(() => {
361cb0ef41Sopenharmony_ci        assert.strictEqual(res.destroyed, true);
371cb0ef41Sopenharmony_ci        server.close();
381cb0ef41Sopenharmony_ci      })).resume();
391cb0ef41Sopenharmony_ci    }));
401cb0ef41Sopenharmony_ci  }));
411cb0ef41Sopenharmony_ci}
42