1   /*
2    * $Id: TcpNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z 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  package org.mule.transport.tcp;
11  
12  import org.mule.tck.FunctionalTestCase;
13  import org.mule.transport.tcp.TcpConnector;
14  
15  /**
16   * TODO
17   */
18  public class TcpNamespaceHandlerTestCase extends FunctionalTestCase
19  {
20      protected String getConfigResources()
21      {
22          return "tcp-namespace-config.xml";
23      }
24  
25      public void testConfig() throws Exception
26      {
27          TcpConnector c = (TcpConnector)muleContext.getRegistry().lookupConnector("tcpConnector");
28          assertNotNull(c);
29          assertEquals(1024, c.getReceiveBufferSize());
30          assertEquals(2048, c.getSendBufferSize());
31          assertEquals(50, c.getReceiveBacklog());
32          assertFalse(c.isReuseAddress().booleanValue());
33          // this is what we want - i was worried that the client was used as default if the server
34          // wasn't set, but that's not the case
35          assertEquals(-1, c.getServerSoTimeout());
36          assertEquals(3000, c.getClientSoTimeout());
37          assertTrue(c.isKeepAlive());
38          assertTrue(c.isConnected());
39          assertTrue(c.isStarted());
40  
41      }
42      
43      public void testSeparateTimeouts() throws Exception
44      {
45          TcpConnector c = (TcpConnector)muleContext.getRegistry().lookupConnector("separateTimeouts");
46          assertNotNull(c);
47          assertEquals(4000, c.getServerSoTimeout());
48          assertEquals(3000, c.getClientSoTimeout());
49          assertTrue(c.isConnected());
50          assertTrue(c.isStarted());
51  
52      }
53  }