1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6 7const http2 = require('http2'); 8 9const server = http2.createServer({ maxSettings: 1 }); 10 11// TODO(@jasnell): There is still a session event 12// emitted on the server side but it will be destroyed 13// immediately after creation and there will be no 14// stream created. 15server.on('session', common.mustCall((session) => { 16 session.on('stream', common.mustNotCall()); 17 session.on('remoteSettings', common.mustNotCall()); 18})); 19server.on('stream', common.mustNotCall()); 20 21server.listen(0, common.mustCall(() => { 22 // Specify two settings entries when a max of 1 is allowed. 23 // Connection should error immediately. 24 const client = http2.connect( 25 `http://localhost:${server.address().port}`, { 26 settings: { 27 // The actual settings values do not matter. 28 headerTableSize: 1000, 29 enablePush: false, 30 }, 31 }); 32 33 client.on('error', common.mustCall(() => { 34 server.close(); 35 })); 36})); 37