%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; const { mustCall, mustSucceed, hasCrypto, skip } = require('../common'); if (!hasCrypto) skip('missing crypto'); const assert = require('assert'); const { createServer, connect } = require('http2'); const Countdown = require('../common/countdown'); // This test ensures that `bufferSize` of Http2Session and Http2Stream work // as expected. { const kSockets = 2; const kTimes = 10; const kBufferSize = 30; const server = createServer(); let client; const countdown = new Countdown(kSockets, () => { client.close(); server.close(); }); server.on('stream', mustCall((stream) => { stream.on('data', mustCall()); stream.on('end', mustCall()); stream.on('close', mustCall(() => { countdown.dec(); })); }, kSockets)); server.listen(0, mustCall(() => { const authority = `http://localhost:${server.address().port}`; client = connect(authority); client.once('connect', mustCall()); for (let j = 0; j < kSockets; j += 1) { const stream = client.request({ ':method': 'POST' }); stream.on('data', () => {}); for (let i = 0; i < kTimes; i += 1) { stream.write(Buffer.allocUnsafe(kBufferSize), mustSucceed()); const expectedSocketBufferSize = kBufferSize * (i + 1); assert.strictEqual(stream.bufferSize, expectedSocketBufferSize); } stream.end(); stream.close(); } })); }