View Javadoc

1   /*
2    * $Id: XmlMessageEOFProtocolTestCase.java 22401 2011-07-13 09:10:18Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.tcp.protocols;
12  
13  import static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertNotNull;
15  
16  public class XmlMessageEOFProtocolTestCase extends XmlMessageProtocolTestCase
17  {
18  
19      @Override
20      public void doSetUp()
21      {
22          setProtocol(new XmlMessageEOFProtocol());
23      }
24  
25      @Override
26      public void testSlowStream() throws Exception
27      {
28          String msgData = "<?xml version=\"1.0\"?><data>hello</data>";
29  
30          SlowInputStream bais = new SlowInputStream(msgData.getBytes());
31  
32          byte[] result = read(bais);
33          assertNotNull(result);
34          // hurray!  get everything
35          assertEquals(msgData, new String(result));
36      }
37  
38  }