Skip to content

Commit 4193d3b

Browse files
committed
Fix #657
1 parent 0f24351 commit 4193d3b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Diff for: test/lib-http-proxy-test.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,11 @@ describe('lib/http-proxy.js', function() {
294294
var proxy = httpProxy.createProxyServer({
295295
target: 'ws://127.0.0.1:' + ports.source,
296296
ws: true
297-
}),
298-
proxyServer = proxy.listen(ports.proxy),
299-
destiny = io.listen(ports.source, function () {
297+
});
298+
proxyServer = proxy.listen(ports.proxy);
299+
var server = http.createServer();
300+
destiny = io.listen(server);
301+
function startSocketIo() {
300302
var client = ioClient.connect('ws://127.0.0.1:' + ports.proxy);
301303

302304
client.on('connect', function () {
@@ -306,10 +308,12 @@ describe('lib/http-proxy.js', function() {
306308
client.on('outgoing', function (data) {
307309
expect(data).to.be('Hello over websockets');
308310
proxyServer._server.close();
309-
destiny.server.close();
311+
server.close();
310312
done();
311313
});
312-
});
314+
}
315+
server.listen(ports.source);
316+
server.on('listening', startSocketIo);
313317

314318
destiny.sockets.on('connection', function (socket) {
315319
socket.on('incoming', function (msg) {

0 commit comments

Comments
 (0)