-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtest.js
48 lines (32 loc) · 951 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var udpStream = require('./')
, test = require('tape');
test('broadcast destination', function (t) {
t.plan(1);
var s = udpStream({ broadcast : '255.255.255.255', port : 61616 });
s.on('data', function (chunk) {
t.equal('hello', chunk.toString());
t.end();
s.end();
});
s.write('hello');
});
test('multicast destination', function (t) {
t.plan(1);
var s = udpStream({ multicast : '239.5.5.5', port : 61616, loopback : true });
s.on('data', function (chunk) {
t.equal('hello', chunk.toString());
t.end();
s.end();
});
s.write('hello');
});
test('unicast destination', function (t) {
t.plan(1);
var s = udpStream({ unicast : '127.0.0.1', port : 61616, address: '127.0.0.1' });
s.on('data', function (chunk) {
t.equal('hello', chunk.toString());
t.end();
s.end();
});
s.write('hello');
});