From e7608eafae474f88ed01f9db5271d7474ce91a01 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 13 Feb 2012 11:06:02 -0700 Subject: [PATCH] Trying to get more information from failing Websocket Draft0 test failure --- .../eclipse/jetty/websocket/WebSocketConnectionD00.java | 1 + .../org/eclipse/jetty/websocket/helper/SafariD00.java | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java index 12ec1101444..9ce788ad7e1 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java @@ -129,6 +129,7 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc int filled=_endp.fill(_hixieBytes); if (filled<0) { + _endp.flush(); _endp.close(); break; } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java index 9fc43eca44f..7a8fcbe63ae 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java @@ -32,6 +32,7 @@ import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.log.StdErrLog; import org.junit.Assert; public class SafariD00 @@ -45,6 +46,10 @@ public class SafariD00 public SafariD00(URI uri) { + if (LOG instanceof StdErrLog) + { + ((StdErrLog)LOG).setLevel(StdErrLog.LEVEL_DEBUG); + } this.uri = uri; this.endpoint = new InetSocketAddress(uri.getHost(),uri.getPort()); } @@ -69,7 +74,7 @@ public class SafariD00 } /** - * Issue an Http websocket (Draft-0) upgrade request using the Safari particulars. + * Issue an Http websocket (Draft-0) upgrade request (using an example request captured from OSX/Safari) * * @throws UnsupportedEncodingException */ @@ -120,6 +125,7 @@ public class SafariD00 // Read expected handshake hixie bytes byte hixieHandshakeExpected[] = TypeUtil.fromHexString("c7438d956cf611a6af70603e6fa54809"); byte hixieHandshake[] = new byte[hixieHandshakeExpected.length]; + Assert.assertThat("Hixie handshake buffer size", hixieHandshake.length, is(16)); LOG.debug("Reading hixie handshake bytes"); int readLen = in.read(hixieHandshake,0,hixieHandshake.length);