open stream in both sides test

This commit is contained in:
David Dias 2015-07-14 19:04:18 -07:00
parent 8853a85d91
commit 9de74aea84
3 changed files with 34 additions and 1 deletions

View File

@ -48,6 +48,38 @@ module.exports.all = function (test, common) {
})
})
test('Open a stream on both sides', function (t) {
common.setup(test, function (err, Muxer) {
t.plan(7)
t.ifError(err, 'Should not throw')
var pair = streamPair.create()
var dialer = new Muxer()
var listener = new Muxer()
var connDialer = dialer.attach(pair, false)
var connListener = listener.attach(pair.other, true)
connDialer.dialStream(function (err, stream) {
t.ifError(err, 'Should not throw')
t.pass('dialed stream from dialer')
})
connListener.on('stream', function (stream) {
t.pass('listener got stream')
})
connListener.dialStream(function (err, stream) {
t.ifError(err, 'Should not throw')
t.pass('dialed stream from listener')
})
connDialer.on('stream', function (stream) {
t.pass('dialer got stream')
})
})
})
test('Open a stream using the net.connect pattern', function (t) {
common.setup(test, function (err, Muxer) {
t.plan(3)

View File

@ -1,6 +1,6 @@
module.exports = function (test, common, mega) {
require('./base-test.js').all(test, common)
require('./stress-test.js').all(test, common)
// require('./stress-test.js').all(test, common)
if (mega) {
require('./mega-stress-test.js').all(test, common)
}

View File

@ -109,6 +109,7 @@ module.exports.all = function (test, common) {
spawnGeneration(t, Muxer, pair, pair.other, 1000, 100)
})
})
}
function spawnGeneration (t, Muxer, dialerSocket, listenerSocket, nStreams, nMsg, size) {