summaryrefslogtreecommitdiff
path: root/tests/testdata/cert/listen_tls_alpn.ts
blob: 6b92364ba2e1b8261fd0a7bb38c1b4ab0a27dd5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const listener = Deno.listenTls({
  port: Number(Deno.args[0]),
  cert: Deno.readTextFileSync("./tls/localhost.crt"),
  key: Deno.readTextFileSync("./tls/localhost.key"),
  alpnProtocols: ["h2", "http/1.1", "foobar"],
});

console.log("READY");

const conn = await listener.accept() as Deno.TlsConn;
await conn.handshake();
conn.close();

listener.close();