2016-06-29 15:29:19 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
2017-07-01 01:29:09 +02:00
|
|
|
if (!common.hasCrypto)
|
2017-06-15 07:21:03 +02:00
|
|
|
common.skip('missing crypto');
|
2017-07-01 01:29:09 +02:00
|
|
|
|
2016-06-29 15:29:19 +02:00
|
|
|
const assert = require('assert');
|
|
|
|
const net = require('net');
|
|
|
|
const tls = require('tls');
|
|
|
|
|
|
|
|
const server = net.createServer((c) => {
|
|
|
|
c.end();
|
|
|
|
}).listen(common.mustCall(() => {
|
|
|
|
const port = server.address().port;
|
|
|
|
|
|
|
|
const socket = new net.Socket();
|
|
|
|
|
|
|
|
tls.connect({ socket })
|
|
|
|
.once('error', common.mustCall((e) => {
|
|
|
|
assert.strictEqual(e.code, 'ECONNRESET');
|
|
|
|
assert.strictEqual(e.path, undefined);
|
|
|
|
assert.strictEqual(e.host, undefined);
|
|
|
|
assert.strictEqual(e.port, undefined);
|
|
|
|
assert.strictEqual(e.localAddress, undefined);
|
|
|
|
server.close();
|
|
|
|
}));
|
|
|
|
|
|
|
|
socket.connect(port);
|
|
|
|
}));
|