summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-inception.js
diff options
context:
space:
mode:
authorSantiago Gimeno <santiago.gimeno@gmail.com>2015-12-08 13:36:38 +0100
committerFedor Indutny <fedor@indutny.com>2015-12-10 03:52:51 -0500
commit86a3bd09b0bca3441ad720286f738957102d9343 (patch)
treee7abf9299cf74337cf9159cde583f478b59c7899 /test/parallel/test-tls-inception.js
parent37ed05b8c154fbd1c2afd02c603ebb48b8527232 (diff)
downloadandroid-node-v8-86a3bd09b0bca3441ad720286f738957102d9343.tar.gz
android-node-v8-86a3bd09b0bca3441ad720286f738957102d9343.tar.bz2
android-node-v8-86a3bd09b0bca3441ad720286f738957102d9343.zip
test: fix tls-inception
Make sure all the data is read before checking its validity. Remove `gotHello` variable and just check that the ssl `end` event is received. Remove unused variables. PR-URL: https://github.com/nodejs/node/pull/4195 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'test/parallel/test-tls-inception.js')
-rw-r--r--test/parallel/test-tls-inception.js14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/parallel/test-tls-inception.js b/test/parallel/test-tls-inception.js
index 12b9f95fac..bf8688fdd2 100644
--- a/test/parallel/test-tls-inception.js
+++ b/test/parallel/test-tls-inception.js
@@ -12,8 +12,7 @@ var fs = require('fs');
var path = require('path');
var net = require('net');
-var options, a, b, portA, portB;
-var gotHello = false;
+var options, a, b;
var body = new Buffer(4000).fill('A');
@@ -43,10 +42,6 @@ b = tls.createServer(options, function(socket) {
socket.end(body);
});
-process.on('exit', function() {
- assert(gotHello);
-});
-
a.listen(common.PORT, function() {
b.listen(common.PORT + 1, function() {
options = {
@@ -62,15 +57,14 @@ a.listen(common.PORT, function() {
});
ssl.setEncoding('utf8');
var buf = '';
- ssl.once('data', function(data) {
+ ssl.on('data', function(data) {
buf += data;
- gotHello = true;
});
- ssl.on('end', function() {
+ ssl.on('end', common.mustCall(function() {
assert.equal(buf, body);
ssl.end();
a.close();
b.close();
- });
+ }));
});
});