11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciif (!common.hasCrypto) { common.skip('missing crypto'); } 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst http2 = require('http2'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst server = http2.createServer(common.mustCall((req, res) => { 81cb0ef41Sopenharmony_ci const hwm = req.socket.writableHighWaterMark; 91cb0ef41Sopenharmony_ci assert.strictEqual(res.writableHighWaterMark, hwm); 101cb0ef41Sopenharmony_ci assert.strictEqual(res.writableLength, 0); 111cb0ef41Sopenharmony_ci res.write(''); 121cb0ef41Sopenharmony_ci const len = res.writableLength; 131cb0ef41Sopenharmony_ci res.write('asd'); 141cb0ef41Sopenharmony_ci assert.strictEqual(res.writableLength, len + 3); 151cb0ef41Sopenharmony_ci res.end(); 161cb0ef41Sopenharmony_ci res.on('finish', common.mustCall(() => { 171cb0ef41Sopenharmony_ci assert.strictEqual(res.writableLength, 0); 181cb0ef41Sopenharmony_ci assert.ok(res.writableFinished, 'writableFinished is not truthy'); 191cb0ef41Sopenharmony_ci server.close(); 201cb0ef41Sopenharmony_ci })); 211cb0ef41Sopenharmony_ci})); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ciserver.listen(0, common.mustCall(() => { 241cb0ef41Sopenharmony_ci const client = http2.connect(`http://localhost:${server.address().port}`); 251cb0ef41Sopenharmony_ci const request = client.request(); 261cb0ef41Sopenharmony_ci request.on('data', common.mustCall()); 271cb0ef41Sopenharmony_ci request.on('end', common.mustCall(() => { 281cb0ef41Sopenharmony_ci client.close(); 291cb0ef41Sopenharmony_ci })); 301cb0ef41Sopenharmony_ci})); 31