| 3478 | }; |
| 3479 | |
| 3480 | function testForTransport(transport, done) { |
| 3481 | const engine = listen((port) => { |
| 3482 | const socket = new ClientSocket(`ws:class="cm">//localhost:${port}`, { |
| 3483 | extraHeaders: headers, |
| 3484 | transports: [transport], |
| 3485 | }); |
| 3486 | engine.on(class="st">"connection", (conn) => { |
| 3487 | for (let h in headers) { |
| 3488 | expect(conn.request.headers[h]).to.equal(headers[h]); |
| 3489 | } |
| 3490 | done(); |
| 3491 | }); |
| 3492 | socket.on(class="st">"open", () => {}); |
| 3493 | }); |
| 3494 | } |
| 3495 | |
| 3496 | it(class="st">"should arrive from client to server via WebSockets", (done) => { |
| 3497 | testForTransport(class="st">"websocket", done); |