(client, callback)
| 35 | }); |
| 36 | |
| 37 | function test(client, callback) { |
| 38 | callback = common.mustCall(callback); |
| 39 | connect({ |
| 40 | server: { |
| 41 | key: keys.agent1.key, |
| 42 | cert: keys.agent1.cert, |
| 43 | }, |
| 44 | }, common.mustCall(function(err, pair, cleanup) { |
| 45 | assert.strictEqual(err.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); |
| 46 | let recv = ''; |
| 47 | pair.server.server.once('secureConnection', common.mustCall((conn) => { |
| 48 | conn.on('data', (data) => recv += data); |
| 49 | conn.on('end', common.mustCall(() => { |
| 50 | // Server sees nothing wrong with connection, even though the client's |
| 51 | // authentication of the server cert failed. |
| 52 | assert.strictEqual(recv, 'hello'); |
| 53 | cleanup(); |
| 54 | })); |
| 55 | })); |
| 56 | |
| 57 | // `new TLSSocket` doesn't support the 'secureConnect' event on client side, |
| 58 | // and doesn't error if authentication failed. Caller must explicitly check |
| 59 | // for failure. |
| 60 | (new tls.TLSSocket(null, client)).connect(pair.server.server.address().port) |
| 61 | .on('connect', common.mustCall(function() { |
| 62 | this.end('hello'); |
| 63 | })) |
| 64 | .on('secure', common.mustCall(function() { |
| 65 | callback(this.ssl.verifyError()); |
| 66 | })); |
| 67 | })); |
| 68 | } |
no test coverage detected
searching dependent graphs…