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