Skip to content

Commit

Permalink
test: add test for ERR_TLS_ALPN_CALLBACK_WITH_PROTOCOLS error case
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Oct 31, 2022
1 parent f0293c2 commit 58af789
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/parallel/test-tls-alpn-server-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,17 @@ function TestBadALPNCallback() {
// Callback returns 'http/5' => doesn't match client ALPN => error & reset
assert.strictEqual(results[0].server, undefined);
assert.strictEqual(results[0].client.error.code, 'ECONNRESET');

TestALPNOptionsCallback();
});
}

function TestALPNOptionsCallback() {
// Server sets two incompatible ALPN options:
assert.throws(() => tls.createServer({
ALPNCallback: () => 'a',
ALPNProtocols: ['b', 'c']
}), (error) => error.code === 'ERR_TLS_ALPN_CALLBACK_WITH_PROTOCOLS');
}

Test1();

0 comments on commit 58af789

Please sign in to comment.