| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4e3731c commit 411b133
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,13 +6,8 @@ const dgram = require('dgram'); | |||
| 6 | 6 | ||
| 7 | 7 | const client = dgram.createSocket('udp4'); | |
| 8 | 8 | ||
| 9 | - const timer = setTimeout(function() { | ||
| 10 | - throw new Error('Timeout'); | ||
| 11 | - }, common.platformTimeout(200)); | ||
| 12 | - | ||
| 13 | 9 | const messageSent = common.mustCall(function messageSent(err, bytes) { | |
| 14 | 10 | assert.equal(bytes, buf1.length + buf2.length); | |
| 15 | - clearTimeout(timer); | ||
| 16 | 11 | }); | |
| 17 | 12 | ||
| 18 | 13 | const buf1 = Buffer.alloc(256, 'x'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,13 +6,8 @@ const dgram = require('dgram'); | |||
| 6 | 6 | ||
| 7 | 7 | const client = dgram.createSocket('udp4'); | |
| 8 | 8 | ||
| 9 | - const timer = setTimeout(function() { | ||
| 10 | - throw new Error('Timeout'); | ||
| 11 | - }, common.platformTimeout(200)); | ||
| 12 | - | ||
| 13 | 9 | const onMessage = common.mustCall(function(err, bytes) { | |
| 14 | 10 | assert.equal(bytes, buf1.length + buf2.length); | |
| 15 | - clearTimeout(timer); | ||
| 16 | 11 | }); | |
| 17 | 12 | ||
| 18 | 13 | const buf1 = Buffer.alloc(256, 'x'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,27 +11,19 @@ const assert = require('assert'); | |||
| 11 | 11 | ||
| 12 | 12 | const bonkers = Buffer.alloc(1024, 42); | |
| 13 | 13 | ||
| 14 | - let tlsClientErrorEmited = false; | ||
| 15 | 14 | ||
| 16 | 15 | const server = tls.createServer({}) | |
| 17 | 16 | .listen(0, function() { | |
| 18 | 17 | const c = net.connect({ port: this.address().port }, function() { | |
| 19 | 18 | c.write(bonkers); | |
| 20 | 19 | }); | |
| 21 | 20 | ||
| 22 | - }).on('tlsClientError', function(e) { | ||
| 23 | - tlsClientErrorEmited = true; | ||
| 21 | + }).on('tlsClientError', common.mustCall(function(e) { | ||
| 24 | 22 | assert.ok(e instanceof Error, | |
| 25 | 23 | 'Instance of Error should be passed to error handler'); | |
| 26 | 24 | assert.ok(e.message.match( | |
| 27 | 25 | /SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol/), | |
| 28 | 26 | 'Expecting SSL unknown protocol'); | |
| 29 | - }); | ||
| 30 | 27 | ||
| 31 | - setTimeout(function() { | ||
| 32 | - server.close(); | ||
| 33 | - | ||
| 34 | - assert.ok(tlsClientErrorEmited, | ||
| 35 | - 'tlsClientError should be emited'); | ||
| 36 | - | ||
| 37 | - }, common.platformTimeout(200)); | ||
| 28 | + server.close(); | ||
| 29 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments