const net = require('net'); const port = process.env.DISPATCHER_PORT || 43170; exports.client = (address) => { return net.createConnection(port, address); }; exports.server = () => { const server = net.createServer(); const originalListen = server.listen; server.listen = () => { return originalListen.call(server, port); } return server; };