<!DOCTYPE html>
<html>
<head>
<title>test ws split packet</title>
<script type="text/javascript">
var href = window.location.href;
var hostBegin = href.indexOf('/') + 2;
var hostEnd = href.lastIndexOf(':');
var host = href.slice(hostBegin, hostEnd);
var portBegin = hostEnd + 1;
var portEnd = href.lastIndexOf('/');
var port = href.slice(portBegin, portEnd);
var scheme = href.indexOf('https') >= 0 ? 'wss' : 'ws';
var url = scheme + '://' + host + ':' + port + '/close-with-split-packet';
// Do connection test.
var ws = new WebSocket(url);
ws.onopen = function()
{
// Close WebSocket connection once it is established.
ws.close();
}
ws.onclose = function(event)
{
// Check wasClean, then set proper title.
if (event.wasClean && event.code === 3004 && event.reason === 'split test')
document.title = 'PASS';
else
document.title = 'FAIL';
}
</script>
</head>
</html>