(client, server)
| 13 | const LOG_ERRORS = process.env.LOG_ERRORS; |
| 14 | |
| 15 | function baseChannelTest(client, server) { |
| 16 | return (_t, done) => { |
| 17 | const decrementLatch = latch(2, done); |
| 18 | const pair = util.socketPair(); |
| 19 | const c = new Connection(pair.client); |
| 20 | |
| 21 | if (LOG_ERRORS) c.on('error', console.warn); |
| 22 | |
| 23 | c.open(OPEN_OPTS, (err, _ok) => { |
| 24 | if (err === null) client(c, decrementLatch); |
| 25 | else decrementLatch(err); |
| 26 | }); |
| 27 | |
| 28 | pair.server.read(8); // discard the protocol header |
| 29 | util.runServer(pair.server, (send, wait) => { |
| 30 | handshake(send, wait).then(() => { |
| 31 | server(send, wait, decrementLatch); |
| 32 | }, decrementLatch); |
| 33 | }); |
| 34 | }; |
| 35 | } |
| 36 | |
| 37 | function channelTest(client, server) { |
| 38 | return baseChannelTest( |
no test coverage detected
searching dependent graphs…