2016-03-31 22:44:02 +02:00
|
|
|
'use strict';
|
|
|
|
|
2017-08-12 00:02:15 +03:00
|
|
|
const common = require('../common');
|
2016-03-31 22:44:02 +02:00
|
|
|
const net = require('net');
|
|
|
|
|
2016-05-29 03:06:56 -04:00
|
|
|
const server = net.createServer().listen(0, connectToServer);
|
2016-03-31 22:44:02 +02:00
|
|
|
|
|
|
|
function connectToServer() {
|
2016-05-29 03:06:56 -04:00
|
|
|
const client = net.createConnection(this.address().port, () => {
|
2017-12-06 22:16:44 +05:30
|
|
|
common.expectsError(() => client.write(1337),
|
|
|
|
{
|
|
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
|
|
type: TypeError
|
|
|
|
});
|
2016-03-31 22:44:02 +02:00
|
|
|
|
|
|
|
client.end();
|
|
|
|
})
|
|
|
|
.on('end', () => server.close());
|
|
|
|
}
|