1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.http;
12
13 import org.mule.api.MuleContext;
14 import org.mule.api.endpoint.InboundEndpoint;
15 import org.mule.api.lifecycle.InitialisationException;
16 import org.mule.api.service.Service;
17 import org.mule.api.transport.Connector;
18 import org.mule.tck.testmodels.fruit.Orange;
19 import org.mule.transport.AbstractConnectorTestCase;
20 import org.mule.transport.tcp.TcpConnector;
21
22 import java.io.IOException;
23
24
25 public class HttpsConnectorTestCase extends AbstractConnectorTestCase
26 {
27
28
29 public Connector createConnector() throws Exception
30 {
31 return createConnector(muleContext, false);
32 }
33
34 public static HttpsConnector createConnector(MuleContext context, boolean initialised)
35 throws IOException, InitialisationException
36 {
37 HttpsConnector cnn = new HttpsConnector();
38 cnn.setMuleContext(context);
39 cnn.setName("HttpsConnector");
40 cnn.setKeyStore("serverKeystore");
41 cnn.setClientKeyStore("clientKeystore");
42 cnn.setClientKeyStorePassword("mulepassword");
43 cnn.setKeyPassword("mulepassword");
44 cnn.setKeyStorePassword("mulepassword");
45 cnn.setTrustStore("trustStore");
46 cnn.setTrustStorePassword("mulepassword");
47 cnn.getDispatcherThreadingProfile().setDoThreading(false);
48
49 if (initialised)
50 {
51 cnn.initialise();
52 }
53 return cnn;
54 }
55
56 public String getTestEndpointURI()
57 {
58 return "https://localhost:60127";
59 }
60
61 public Object getValidMessage() throws Exception
62 {
63 return "Hello".getBytes();
64 }
65
66 public void testValidListener() throws Exception
67 {
68 Service service = getTestService("orange", Orange.class);
69 InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(
70 getTestEndpointURI());
71
72 getConnector().registerListener(service, endpoint);
73 }
74
75 public void testProperties() throws Exception
76 {
77 HttpsConnector c = (HttpsConnector)getConnector();
78
79 c.setSendBufferSize(1024);
80 assertEquals(1024, c.getSendBufferSize());
81 c.setSendBufferSize(0);
82 assertEquals(TcpConnector.DEFAULT_BUFFER_SIZE, c.getSendBufferSize());
83
84
85 }
86 }