diff --git a/README.md b/README.md index 1d20d38..9a2176f 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ This method dials a connection to the Peer referenced by the peerInfo object. multiaddr must be of the type [`multiaddr`](http://npmjs.org/multiaddr). -`stream` must implements the [abstract-stream](https://github.com/diasdavid/abstract-stream) interface. +`stream` must implements the [abstract-transport](https://github.com/diasdavid/abstract-transport) interface. `[options]` are not mandatory fields for all the implementations that might be passed for certain implementations for them to work (e.g. a Signalling Server for a WebRTC transport/connection implementation) @@ -72,7 +72,7 @@ multiaddr must be of the type [`multiaddr`](http://npmjs.org/multiaddr). This method waits and listens for incoming connections by other peers. -`stream` must be a stream that implements the [abstract-stream](https://github.com/diasdavid/abstract-stream) interface. +`stream` must be a stream that implements the [abstract-transport](https://github.com/diasdavid/abstract-transport) interface. Options are the properties this listener must have access in order to properly listen on a given transport/socket diff --git a/package.json b/package.json index 5455457..9ac97c0 100644 --- a/package.json +++ b/package.json @@ -21,5 +21,11 @@ "bugs": { "url": "https://github.com/diasdavid/abstract-connection/issues" }, - "homepage": "https://github.com/diasdavid/abstract-connection" + "homepage": "https://github.com/diasdavid/abstract-connection", + "devDependencies": { + }, + "dependencies": { + "multiaddr": "^1.0.0", + "timed-tape": "^0.1.0" + } } diff --git a/tests/base-test.js b/tests/base-test.js index e0f2b15..e136ef0 100644 --- a/tests/base-test.js +++ b/tests/base-test.js @@ -1,13 +1,31 @@ +var multiaddr = require('multiaddr') + module.exports.all = function (test, common) { test('a test', function (t) { - common.setup(test, function (err, Connection) { + common.setup(test, function (err, conn) { + t.plan(5) t.ifError(err) - t.pass('woot!') - t.end() + + var maddr = multiaddr('/ip4/127.0.0.1/tcp/9050') + + var listener = conn.createListener(function (stream) { + t.pass('received incoming connection') + stream.end() + listener.close(function () { + t.pass('listener closed successfully') + t.end() + }) + }) + + listener.listen(maddr.nodeAddress().port, function () { + t.pass('started listening') + var stream = conn.dial(maddr, { + ready: function () { + t.pass('dialed successfuly') + stream.end() + } + }) + }) }) }) - - // test for: - // 1. dial and listen - // 2. close }