1'use strict'; 2 3const common = require('../common'); 4if (common.isWindows) 5 common.skip('Unix-specific test'); 6 7const assert = require('assert'); 8const net = require('net'); 9 10const tmpdir = require('../common/tmpdir'); 11tmpdir.refresh(); 12 13const server = net.createServer((connection) => { 14 connection.on('error', (err) => { 15 throw err; 16 }); 17 18 const writev = connection._writev.bind(connection); 19 connection._writev = common.mustCall(writev); 20 21 connection.cork(); 22 connection.write('pi'); 23 connection.write('ng'); 24 connection.end(); 25}); 26 27server.on('error', (err) => { 28 throw err; 29}); 30 31server.listen(common.PIPE, () => { 32 const client = net.connect(common.PIPE); 33 34 client.on('error', (err) => { 35 throw err; 36 }); 37 38 client.on('data', common.mustCall((data) => { 39 assert.strictEqual(data.toString(), 'ping'); 40 })); 41 42 client.on('end', () => { 43 server.close(); 44 }); 45}); 46