11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciif (!common.hasCrypto) 51cb0ef41Sopenharmony_ci common.skip('missing crypto'); 61cb0ef41Sopenharmony_ciconst assert = require('assert'); 71cb0ef41Sopenharmony_ciconst http2 = require('http2'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst http2Server = http2.createServer(common.mustCall(function(req, res) { 101cb0ef41Sopenharmony_ci res.socket.on('finish', common.mustCall(() => { 111cb0ef41Sopenharmony_ci assert(req.socket.bytesWritten > 0); // 1094 121cb0ef41Sopenharmony_ci })); 131cb0ef41Sopenharmony_ci res.writeHead(200, { 'Content-Type': 'text/plain' }); 141cb0ef41Sopenharmony_ci res.write(Buffer.from('1'.repeat(1024))); 151cb0ef41Sopenharmony_ci res.end(); 161cb0ef41Sopenharmony_ci})); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_cihttp2Server.listen(0, common.mustCall(function() { 191cb0ef41Sopenharmony_ci const URL = `http://localhost:${http2Server.address().port}`; 201cb0ef41Sopenharmony_ci const http2client = http2.connect(URL, { protocol: 'http:' }); 211cb0ef41Sopenharmony_ci const req = http2client.request({ ':method': 'GET', ':path': '/' }); 221cb0ef41Sopenharmony_ci req.on('data', common.mustCall()); 231cb0ef41Sopenharmony_ci req.on('end', common.mustCall(function() { 241cb0ef41Sopenharmony_ci http2client.close(); 251cb0ef41Sopenharmony_ci http2Server.close(); 261cb0ef41Sopenharmony_ci })); 271cb0ef41Sopenharmony_ci req.end(); 281cb0ef41Sopenharmony_ci})); 29