Skip to content

Commit

Permalink
Fix #657
Browse files Browse the repository at this point in the history
  • Loading branch information
Rush committed Jun 9, 2014
1 parent 0f24351 commit 159ca83
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/lib-http-proxy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,11 @@ describe('lib/http-proxy.js', function() {
var proxy = httpProxy.createProxyServer({
target: 'ws://127.0.0.1:' + ports.source,
ws: true
}),
proxyServer = proxy.listen(ports.proxy),
destiny = io.listen(ports.source, function () {
});
proxyServer = proxy.listen(ports.proxy);
var server = http.createServer();
destiny = io.listen(server);
function startSocketIo() {
var client = ioClient.connect('ws://127.0.0.1:' + ports.proxy);

client.on('connect', function () {
Expand All @@ -306,10 +308,12 @@ describe('lib/http-proxy.js', function() {
client.on('outgoing', function (data) {
expect(data).to.be('Hello over websockets');
proxyServer._server.close();
destiny.server.close();
server.close();
done();
});
});
}
server.listen(ports.source);
server.on('listening', startSocketIo);

destiny.sockets.on('connection', function (socket) {
socket.on('incoming', function (msg) {
Expand Down

0 comments on commit 159ca83

Please sign in to comment.