View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.ssl.issues;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.module.client.MuleClient;
11  import org.mule.tck.junit4.FunctionalTestCase;
12  import org.mule.tck.junit4.rule.DynamicPort;
13  
14  import org.junit.Rule;
15  import org.junit.Test;
16  
17  import static org.junit.Assert.assertEquals;
18  import static org.junit.Assert.assertNotNull;
19  
20  public class AsynchronousSslMule1854TestCase extends FunctionalTestCase
21  {
22  
23      @Rule
24      public DynamicPort dynamicPort1 = new DynamicPort("port1");
25  
26      @Rule
27      public DynamicPort dynamicPort2 = new DynamicPort("port2");
28  
29      @Rule
30      public DynamicPort dynamicPort3 = new DynamicPort("port3");
31  
32      @Override
33      protected String getConfigResources()
34      {
35          return "ssl-functional-test.xml";
36      }
37  
38      @Test
39      public void testAsynchronous() throws Exception
40      {
41          MuleClient client = new MuleClient(muleContext);
42          client.dispatch("asyncEndpoint", TEST_MESSAGE, null);
43          // MULE-2757
44          Thread.sleep(1000);
45          MuleMessage response = client.request("asyncEndpoint", 5000);
46          assertNotNull("Response is null", response);
47          assertEquals(TEST_MESSAGE + " Received Async", response.getPayloadAsString());
48      }
49  
50  }