|
1 | 1 | 'use strict'; |
2 | 2 | const common = require('../common'); |
3 | | -const assert = require('assert'); |
4 | 3 | |
5 | 4 | if (!common.hasCrypto) |
6 | 5 | common.skip('missing crypto'); |
7 | 6 | |
8 | | -const tls = require('tls'); |
| 7 | +const assert = require('assert'); |
9 | 8 | const fs = require('fs'); |
10 | 9 | const path = require('path'); |
| 10 | +const tls = require('tls'); |
11 | 11 | |
12 | 12 | // https://github.com/joyent/node/issues/1218 |
13 | 13 | // uncatchable exception on TLS connection error |
@@ -18,7 +18,10 @@ const path = require('path');
|
18 | 18 | const options = {cert: cert, key: key, port: common.PORT}; |
19 | 19 | const conn = tls.connect(options, common.fail); |
20 | 20 | |
21 | | -conn.on('error', common.mustCall()); |
| 21 | +conn.on( |
| 22 | +'error', |
| 23 | +common.mustCall((e) => { assert.strictEqual(e.code, 'ECONNREFUSED'); }) |
| 24 | +); |
22 | 25 | } |
23 | 26 | |
24 | 27 | // SSL_accept/SSL_connect error handling |
@@ -35,5 +38,8 @@ const path = require('path');
|
35 | 38 | assert.ok(false); // callback should never be executed |
36 | 39 | }); |
37 | 40 | |
38 | | -conn.on('error', common.mustCall()); |
| 41 | +conn.on( |
| 42 | +'error', |
| 43 | +common.mustCall((e) => { assert.strictEqual(e.code, 'ECONNREFUSED'); }) |
| 44 | +); |
39 | 45 | } |