1

I am working a project that involves a java client interacting with a socket.io based server over websockets. In order to test fallback from websockets to xhr-polling i need to simulate a websocket blocking on my windows host.

How can this be done ?

2
  • sounds like something you can set in your firewall settings
    – yhussain
    Commented Jan 31, 2015 at 22:20
  • 2
    @yhussain - kind of difficult to block in a firewall because a webSocket request starts out as an HTTP request to your web server on the normal port 80. In fact, one reason it was designed this way is so that it would work with most firewalls that were permitting web traffic.
    – jfriend00
    Commented Feb 1, 2015 at 0:30

1 Answer 1

3

It is not trivial to disable websocket in Windows firewall. Disabling this protocol in browser is not a way - in case you want to test fallback when websocket supported by browser but blocked by firewall, antivirus, domain policy rules, ...

I've simulated this behaviour by running nodejs server with grunt-connect-proxy. By default it blocks ws:// protocol but you can easy enable it using

option.ws = true

Not the answer you're looking for? Browse other questions tagged or ask your own question.