Author: markt Date: Thu Jun 27 20:10:40 2013 New Revision: 1497552 URL: http://svn.apache.org/r1497552 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55151 Fix bugs in test
Modified: tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java Modified: tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java?rev=1497552&r1=1497551&r2=1497552&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java (original) +++ tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java Thu Jun 27 20:10:40 2013 @@ -108,7 +108,7 @@ public class TestEncodingDecoding extend Assert.assertEquals(MESSAGE_ONE, ((MsgString) MsgStringMessageHandler.received.peek()).getData()); Assert.assertEquals(MESSAGE_ONE, - ((MsgString) client.received.peek()).getData()); + new String(((MsgByte) client.received.peek()).getData())); session.close(); } @@ -272,8 +272,8 @@ public class TestEncodingDecoding extend public void onMessage(MsgString in) { received.add(in); try { - MsgString msg = new MsgString(); - msg.setData(MESSAGE_ONE); + MsgByte msg = new MsgByte(); + msg.setData(MESSAGE_ONE.getBytes()); session.getBasicRemote().sendObject(msg); } catch (IOException | EncodeException e) { e.printStackTrace(); @@ -368,6 +368,7 @@ public class TestEncodingDecoding extend reply.put((byte) 0x12); reply.put((byte) 0x34); reply.put(data); + reply.flip(); return reply; } } @@ -388,7 +389,6 @@ public class TestEncodingDecoding extend @Override public MsgByte decode(ByteBuffer bb) throws DecodeException { MsgByte result = new MsgByte(); - bb.position(bb.position() + 2); byte[] data = new byte[bb.limit() - bb.position()]; bb.get(data); result.setData(data); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org