2010-10-24 11:07:00 +08:00
|
|
|
require(__dirname+'/../test-helper');
|
2010-10-07 08:59:20 +08:00
|
|
|
MemoryStream = function() {
|
|
|
|
EventEmitter.call(this);
|
2010-10-07 10:34:51 +08:00
|
|
|
this.packets = [];
|
2010-10-07 08:59:20 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
sys.inherits(MemoryStream, EventEmitter);
|
|
|
|
|
|
|
|
var p = MemoryStream.prototype;
|
2010-10-08 09:00:49 +08:00
|
|
|
|
|
|
|
p.write = function(packet) {
|
|
|
|
this.packets.push(packet);
|
|
|
|
};
|
2010-10-20 11:58:25 +08:00
|
|
|
|
|
|
|
createClient = function() {
|
|
|
|
var stream = new MemoryStream();
|
|
|
|
stream.readyState = "open";
|
|
|
|
var client = new Client({
|
2010-10-25 11:52:12 +08:00
|
|
|
connection: new Connection({stream: stream})
|
2010-10-20 11:58:25 +08:00
|
|
|
});
|
|
|
|
client.connect();
|
2010-10-20 12:02:33 +08:00
|
|
|
return client;
|
2010-10-20 11:58:25 +08:00
|
|
|
};
|