• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6
7const assert = require('assert');
8const https = require('https');
9const net = require('net');
10
11const server = net.createServer(function(s) {
12  s.once('data', function() {
13    s.end('I was waiting for you, hello!', function() {
14      s.destroy();
15    });
16  });
17});
18
19server.listen(0, function() {
20  const req = https.request({ port: this.address().port });
21  req.end();
22
23  req.once('error', common.mustCall(function(err) {
24    assert(/wrong version number/.test(err.message));
25    server.close();
26  }));
27});
28