summaryrefslogtreecommitdiff
path: root/tests/unit_node/tls_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_node/tls_test.ts')
-rw-r--r--tests/unit_node/tls_test.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit_node/tls_test.ts b/tests/unit_node/tls_test.ts
index 93eacd5ec..43d6205b0 100644
--- a/tests/unit_node/tls_test.ts
+++ b/tests/unit_node/tls_test.ts
@@ -229,3 +229,31 @@ Deno.test("tls.rootCertificates is not empty", () => {
(tls.rootCertificates as string[]).push("new cert");
}, TypeError);
});
+
+Deno.test("TLSSocket.alpnProtocol is set for client", async () => {
+ const listener = Deno.listenTls({
+ hostname: "localhost",
+ port: 0,
+ key,
+ cert,
+ alpnProtocols: ["a"],
+ });
+ const outgoing = tls.connect({
+ host: "::1",
+ servername: "localhost",
+ port: listener.addr.port,
+ ALPNProtocols: ["a"],
+ secureContext: {
+ ca: rootCaCert,
+ // deno-lint-ignore no-explicit-any
+ } as any,
+ });
+
+ const conn = await listener.accept();
+ const handshake = await conn.handshake();
+ assertEquals(handshake.alpnProtocol, "a");
+ conn.close();
+ outgoing.destroy();
+ listener.close();
+ await new Promise((resolve) => outgoing.on("close", resolve));
+});