Skip to content

Commit

Permalink
Add server support for new test
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrichter committed Mar 4, 2024
1 parent cdbfadf commit 36b5569
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions main/test/fixtures/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,30 @@ export async function createServer() {
}
},

// echo server, initiated by local
async () => {
for await (const session of getReaderStream(
server.sessionStream('/bidirectional_server_fin_send')
)) {
try {
// adapted from issue of achingbrain
const stream = await session.createBidirectionalStream()

const writer = stream.writable.getWriter()

await writer.ready

writer.write(Uint8Array.from([0, 1, 2, 3])).catch((err) => {
console.info('error writing to stream', err)
})

await writer.close()
} catch {
// in some tests the client closes the stream
}
}
},

// echo datagrams, initiated by remote
async () => {
for await (const session of getReaderStream(
Expand Down

0 comments on commit 36b5569

Please sign in to comment.