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>
This commit is contained in:
parent
37ed05b8c1
commit
86a3bd09b0
@ -12,8 +12,7 @@ var fs = require('fs');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var net = require('net');
|
var net = require('net');
|
||||||
|
|
||||||
var options, a, b, portA, portB;
|
var options, a, b;
|
||||||
var gotHello = false;
|
|
||||||
|
|
||||||
var body = new Buffer(4000).fill('A');
|
var body = new Buffer(4000).fill('A');
|
||||||
|
|
||||||
@ -43,10 +42,6 @@ b = tls.createServer(options, function(socket) {
|
|||||||
socket.end(body);
|
socket.end(body);
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('exit', function() {
|
|
||||||
assert(gotHello);
|
|
||||||
});
|
|
||||||
|
|
||||||
a.listen(common.PORT, function() {
|
a.listen(common.PORT, function() {
|
||||||
b.listen(common.PORT + 1, function() {
|
b.listen(common.PORT + 1, function() {
|
||||||
options = {
|
options = {
|
||||||
@ -62,15 +57,14 @@ a.listen(common.PORT, function() {
|
|||||||
});
|
});
|
||||||
ssl.setEncoding('utf8');
|
ssl.setEncoding('utf8');
|
||||||
var buf = '';
|
var buf = '';
|
||||||
ssl.once('data', function(data) {
|
ssl.on('data', function(data) {
|
||||||
buf += data;
|
buf += data;
|
||||||
gotHello = true;
|
|
||||||
});
|
});
|
||||||
ssl.on('end', function() {
|
ssl.on('end', common.mustCall(function() {
|
||||||
assert.equal(buf, body);
|
assert.equal(buf, body);
|
||||||
ssl.end();
|
ssl.end();
|
||||||
a.close();
|
a.close();
|
||||||
b.close();
|
b.close();
|
||||||
});
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user