1   /*
2    * $Id: SynchStreamingMule1687TestCase.java 11179 2008-03-05 13:46:23Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.issues;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.module.client.MuleClient;
16  import org.mule.tck.FunctionalTestCase;
17  import org.mule.transport.DefaultMessageAdapter;
18  
19  import java.io.ByteArrayInputStream;
20  import java.io.InputStream;
21  
22  public class SynchStreamingMule1687TestCase extends FunctionalTestCase
23  {
24  
25      public static final String TEST_MESSAGE = "Test TCP Request";
26  
27      protected String getConfigResources()
28      {
29          return "tcp-synch-streaming-test.xml";
30      }
31  
32      public void testSendAndRequest() throws Exception
33      {
34          MuleClient client = new MuleClient();
35          MuleMessage message = client.send("tcp://localhost:65432",
36              new DefaultMuleMessage(new DefaultMessageAdapter(new ByteArrayInputStream(TEST_MESSAGE.getBytes()))));
37          assertNotNull(message);
38  
39          Object payload = message.getPayload();
40          assertTrue(payload instanceof InputStream);
41          assertEquals("Some value - set to make test ok", message.getPayloadAsString());
42      }
43  
44  }
45