mirror of https://gitee.com/openkylin/nodejs.git
21 lines
495 B
JavaScript
21 lines
495 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
const server = net.createServer().listen(0, connectToServer);
|
|
|
|
function connectToServer() {
|
|
const client = net.createConnection(this.address().port, () => {
|
|
assert.throws(() => client.write(1337),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError'
|
|
});
|
|
|
|
client.end();
|
|
})
|
|
.on('end', () => server.close());
|
|
}
|