1 /*
2 * $Id: SafeProtocolMule2227TestCase.java 10789 2008-02-12 20:04:43Z 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.api.MuleException;
14 import org.mule.module.client.MuleClient;
15 import org.mule.transport.tcp.protocols.SafeProtocolTestCase;
16
17 public class SafeProtocolMule2227TestCase extends SafeProtocolTestCase
18 {
19
20 // this actually "works" much of the time, in that a response is received that looks reasonable.
21 // that's just because the test is so simple that the length encoded string is read by the
22 // server as a literal chunk of text (including the cookies and lengths!). on the return these
23 // are still present so the data that were sent are read (missing the appended text).
24
25 // the rest of the time, it gives an out of memory error. that's because it responds to the
26 // cookie alone, which means that "Received" is taken as a message, and "Re" gives a length of
27 // 542270819 leading to a memory overflow
28
29 // the only way round this i can see is to allow a parameter on the protocol to specify a
30 // maximum size. see MULE-2449.
31
32 // update - we now do have a maximum size
33
34 public void testSafeToUnsafe() throws MuleException
35 {
36 MuleClient client = new MuleClient();
37 // this may fail, but should not crash
38 try
39 {
40 client.send("tcp://localhost:65433?connector=safe", TEST_MESSAGE, null);
41 }
42 catch(Exception e)
43 {
44 // an error is ok - we were losing the JVM before
45 }
46 }
47
48 }