mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Fix #657
This commit is contained in:
parent
0f243516e1
commit
159ca83652
@ -294,9 +294,11 @@ describe('lib/http-proxy.js', function() {
|
|||||||
var proxy = httpProxy.createProxyServer({
|
var proxy = httpProxy.createProxyServer({
|
||||||
target: 'ws://127.0.0.1:' + ports.source,
|
target: 'ws://127.0.0.1:' + ports.source,
|
||||||
ws: true
|
ws: true
|
||||||
}),
|
});
|
||||||
proxyServer = proxy.listen(ports.proxy),
|
proxyServer = proxy.listen(ports.proxy);
|
||||||
destiny = io.listen(ports.source, function () {
|
var server = http.createServer();
|
||||||
|
destiny = io.listen(server);
|
||||||
|
function startSocketIo() {
|
||||||
var client = ioClient.connect('ws://127.0.0.1:' + ports.proxy);
|
var client = ioClient.connect('ws://127.0.0.1:' + ports.proxy);
|
||||||
|
|
||||||
client.on('connect', function () {
|
client.on('connect', function () {
|
||||||
@ -306,10 +308,12 @@ describe('lib/http-proxy.js', function() {
|
|||||||
client.on('outgoing', function (data) {
|
client.on('outgoing', function (data) {
|
||||||
expect(data).to.be('Hello over websockets');
|
expect(data).to.be('Hello over websockets');
|
||||||
proxyServer._server.close();
|
proxyServer._server.close();
|
||||||
destiny.server.close();
|
server.close();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
server.listen(ports.source);
|
||||||
|
server.on('listening', startSocketIo);
|
||||||
|
|
||||||
destiny.sockets.on('connection', function (socket) {
|
destiny.sockets.on('connection', function (socket) {
|
||||||
socket.on('incoming', function (msg) {
|
socket.on('incoming', function (msg) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user