1
2
3
4
5
6
7
8
9
10
11 package org.mule.providers.tcp;
12
13 import org.mule.config.MuleProperties;
14 import org.mule.extras.client.MuleClient;
15 import org.mule.impl.MuleMessage;
16 import org.mule.tck.FunctionalTestCase;
17 import org.mule.umo.UMOMessage;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 public class TcpRemoteSyncTestCase extends FunctionalTestCase
23 {
24
25 public static final String message = "mule";
26
27 protected String getConfigResources()
28 {
29 return "tcp-remotesync.xml";
30 }
31
32 public void testTcpTcpRemoteSync() throws Exception
33 {
34 MuleClient client = new MuleClient();
35 Map props = new HashMap();
36
37
38 props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, Boolean.TRUE);
39 UMOMessage reply = client.send("tcp://localhost:6161", new MuleMessage(message), props);
40
41 assertNotNull(reply);
42 assertNotNull(reply.getPayload());
43 assertEquals("Received: " + message, reply.getPayloadAsString());
44
45 }
46
47 public void testTcpVmRemoteSync() throws Exception
48 {
49 MuleClient client = new MuleClient();
50 Map props = new HashMap();
51
52
53 props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, Boolean.TRUE);
54
55 UMOMessage reply = client.send("tcp://localhost:6163", new MuleMessage(message), props);
56
57 assertNotNull(reply);
58 assertNotNull(reply.getPayload());
59 assertEquals("Received: " + message, reply.getPayloadAsString());
60
61 }
62
63 }