4 <script src=
"/js-test-resources/js-test.js"></script>
7 <div id=
"description"></div>
8 <div id=
"console"></div>
10 description("Test that WebSocket handshake fails if Connection header field isn't reflected by the server.");
12 window
.jsTestIsAsync
= true;
16 clearTimeout(timeoutID
);
20 var url
= "ws://localhost:8880/handshake-fail-by-no-connection-header";
21 var ws
= new WebSocket(url
);
23 ws
.onopen = function()
25 testFailed("Unexpectedly Connected.");
28 ws
.onmessage = function(messageEvent
)
30 protocol
= messageEvent
.data
;
34 ws
.onclose = function()
39 ws
.onerror = function(errorEvent
)
41 testPassed("onerror() was called");
44 function timeOutCallback()
46 debug("Timed out in state: " + ws
.readyState
);
50 var timeoutID
= setTimeout(timeOutCallback
, 3000);