|
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 | return;
|
8 | 7 | }
|
9 |
| -const tls = require('tls'); |
10 | 8 |
|
| 9 | +const assert = require('assert'); |
11 | 10 | const fs = require('fs');
|
12 |
| - |
| 11 | +const tls = require('tls'); |
13 | 12 |
|
14 | 13 | let received = '';
|
15 | 14 |
|
16 | 15 | const server = tls.createServer({
|
17 | 16 | key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
|
18 | 17 | cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
|
19 |
| -}, function(c) { |
20 |
| - c._write('hello ', null, function() { |
21 |
| - c._write('world!', null, function() { |
| 18 | +}, common.mustCall(function(c) { |
| 19 | + c._write('hello ', null, common.mustCall(function() { |
| 20 | + c._write('world!', null, common.mustCall(function() { |
22 | 21 | c.destroy();
|
23 |
| - }); |
24 |
| - c._write(' gosh', null, common.noop); |
25 |
| - }); |
| 22 | + })); |
| 23 | + // Data on next _write() will be written but callback will not be invoked |
| 24 | + c._write(' gosh', null, common.mustNotCall()); |
| 25 | + })); |
26 | 26 |
|
27 | 27 | server.close();
|
28 |
| -}).listen(0, common.mustCall(function() { |
| 28 | +})).listen(0, common.mustCall(function() { |
29 | 29 | const c = tls.connect(this.address().port, {
|
30 | 30 | rejectUnauthorized: false
|
31 | 31 | }, common.mustCall(function() {
|
|
0 commit comments