update test

This commit is contained in:
AJ ONeal 2016-09-30 02:35:29 -04:00
parent 090f1c927d
commit b233e4cf29
1 changed files with 11 additions and 2 deletions

13
test.js
View File

@ -7,8 +7,11 @@ var address = {
family: 'IPv4' family: 'IPv4'
, address: '127.0.1.1' , address: '127.0.1.1'
, port: 443 , port: 443
, service: 'foo'
}; };
var header = address.family + ',' + address.address + ',' + address.port + ',' + hello.byteLength; var header = address.family + ',' + address.address + ',' + address.port + ',' + hello.byteLength
+ ',' + (address.service || '')
;
var buf = Buffer.concat([ var buf = Buffer.concat([
Buffer.from([ 255 - version, header.length ]) Buffer.from([ 255 - version, header.length ])
, Buffer.from(header) , Buffer.from(header)
@ -19,7 +22,7 @@ var clients = {};
var count = 0; var count = 0;
var packer = require('./'); var packer = require('./');
var machine = packer.create({ var machine = packer.create({
onMessage: function (opts) { onmessage: function (opts) {
var id = opts.family + ',' + opts.address + ',' + opts.port; var id = opts.family + ',' + opts.address + ',' + opts.port;
var service = 'https'; var service = 'https';
var port = services[service]; var port = services[service];
@ -44,6 +47,12 @@ var machine = packer.create({
count += 1; count += 1;
} }
, onerror: function () {
throw new Error("Did not expect onerror");
}
, onend: function () {
throw new Error("Did not expect onend");
}
}); });
var packed = packer.pack(address, hello); var packed = packer.pack(address, hello);