11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciif (common.isWindows) 51cb0ef41Sopenharmony_ci common.skip('Unix-specific test'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ciconst net = require('net'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir'); 111cb0ef41Sopenharmony_citmpdir.refresh(); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst server = net.createServer((connection) => { 141cb0ef41Sopenharmony_ci connection.on('error', (err) => { 151cb0ef41Sopenharmony_ci throw err; 161cb0ef41Sopenharmony_ci }); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci const writev = connection._writev.bind(connection); 191cb0ef41Sopenharmony_ci connection._writev = common.mustCall(writev); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci connection.cork(); 221cb0ef41Sopenharmony_ci connection.write('pi'); 231cb0ef41Sopenharmony_ci connection.write('ng'); 241cb0ef41Sopenharmony_ci connection.end(); 251cb0ef41Sopenharmony_ci}); 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciserver.on('error', (err) => { 281cb0ef41Sopenharmony_ci throw err; 291cb0ef41Sopenharmony_ci}); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ciserver.listen(common.PIPE, () => { 321cb0ef41Sopenharmony_ci const client = net.connect(common.PIPE); 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci client.on('error', (err) => { 351cb0ef41Sopenharmony_ci throw err; 361cb0ef41Sopenharmony_ci }); 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci client.on('data', common.mustCall((data) => { 391cb0ef41Sopenharmony_ci assert.strictEqual(data.toString(), 'ping'); 401cb0ef41Sopenharmony_ci })); 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_ci client.on('end', () => { 431cb0ef41Sopenharmony_ci server.close(); 441cb0ef41Sopenharmony_ci }); 451cb0ef41Sopenharmony_ci}); 46