1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.http;
12
13 import org.mule.tck.junit4.FunctionalTestCase;
14 import org.mule.tck.junit4.rule.DynamicPort;
15
16 import org.apache.commons.httpclient.HttpClient;
17 import org.apache.commons.httpclient.methods.GetMethod;
18 import org.junit.Rule;
19 import org.junit.Test;
20
21 import static org.junit.Assert.assertEquals;
22
23 public class HttpsFlowTestCase extends FunctionalTestCase
24 {
25
26 @Rule
27 public DynamicPort dynamicPort = new DynamicPort("port1");
28
29 @Override
30 protected String getConfigResources()
31 {
32 return "https-flow-config.xml";
33 }
34
35 @Test
36 public void testSecureFlow() throws Exception
37 {
38 String url = String.format("https://localhost:%1d/?message=Hello", dynamicPort.getNumber());
39
40 GetMethod method = new GetMethod(url);
41 HttpClient client = new HttpClient();
42
43 int responseCode = client.executeMethod(method);
44 assertEquals(HttpConstants.SC_OK, responseCode);
45
46 String result = method.getResponseBodyAsString();
47 assertEquals("/?message=Hello received", result);
48 }
49 }
50
51