11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst http = require('http');
61cb0ef41Sopenharmony_ciconst net = require('net');
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciconst originalConnect = net.Socket.prototype.connect;
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cinet.Socket.prototype.connect = common.mustCall(function(args) {
111cb0ef41Sopenharmony_ci  assert.strictEqual(args[0].noDelay, true);
121cb0ef41Sopenharmony_ci  return originalConnect.call(this, args);
131cb0ef41Sopenharmony_ci});
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciconst server = http.createServer(common.mustCall((req, res) => {
161cb0ef41Sopenharmony_ci  res.writeHead(200);
171cb0ef41Sopenharmony_ci  res.end();
181cb0ef41Sopenharmony_ci  server.close();
191cb0ef41Sopenharmony_ci}));
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ciserver.listen(0, common.mustCall(() => {
221cb0ef41Sopenharmony_ci  assert.strictEqual(server.noDelay, true);
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci  const req = http.request({
251cb0ef41Sopenharmony_ci    method: 'GET',
261cb0ef41Sopenharmony_ci    port: server.address().port
271cb0ef41Sopenharmony_ci  }, common.mustCall((res) => {
281cb0ef41Sopenharmony_ci    res.on('end', () => {
291cb0ef41Sopenharmony_ci      server.close();
301cb0ef41Sopenharmony_ci      res.req.socket.end();
311cb0ef41Sopenharmony_ci    });
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ci    res.resume();
341cb0ef41Sopenharmony_ci  }));
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci  req.end();
371cb0ef41Sopenharmony_ci}));
38