2015-02-02 15:30:05 +00:00
|
|
|
var bitmessage = require("../lib");
|
|
|
|
var structs = bitmessage.structs;
|
|
|
|
var message = structs.message;
|
2015-02-03 20:13:27 +00:00
|
|
|
var WsTransport = require("../lib/net/ws").Transport;
|
2015-02-02 15:30:05 +00:00
|
|
|
|
2015-02-05 18:38:36 +00:00
|
|
|
var TcpTransport, tcp;
|
|
|
|
|
2015-02-02 15:30:05 +00:00
|
|
|
if (!process.browser) {
|
2015-02-05 18:38:36 +00:00
|
|
|
TcpTransport = require("../lib/net/tcp").Transport;
|
2015-02-02 15:30:05 +00:00
|
|
|
|
|
|
|
describe("TCP transport", function() {
|
2015-02-05 18:38:36 +00:00
|
|
|
before(function(done) {
|
|
|
|
tcp = new TcpTransport();
|
|
|
|
tcp.on("error", function(err) {
|
|
|
|
console.log("TCP transport error:", err);
|
|
|
|
});
|
|
|
|
// Wait some time for server.
|
|
|
|
setTimeout(done, 1000);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should allow to interconnect two nodes", function(done) {
|
|
|
|
tcp.connect(22333, "127.0.0.1");
|
|
|
|
tcp.on("open", function() {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should allow to close connection", function(done) {
|
|
|
|
tcp.close();
|
|
|
|
tcp.on("close", function() {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2015-02-02 15:30:05 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
describe("WebSocket transport", function() {
|
|
|
|
it("should allow to communicate between two nodes");
|
|
|
|
});
|