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 @Override
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(muleContext);
38 cnn.setName("HttpsConnector");
39 cnn.setKeyStore("serverKeystore");
40 cnn.setClientKeyStore("clientKeystore");
41 cnn.setClientKeyStorePassword("mulepassword");
42 cnn.setKeyPassword("mulepassword");
43 cnn.setKeyStorePassword("mulepassword");
44 cnn.setTrustStore("trustStore");
45 cnn.setTrustStorePassword("mulepassword");
46 cnn.getDispatcherThreadingProfile().setDoThreading(false);
47
48 if (initialised)
49 {
50 cnn.initialise();
51 }
52 return cnn;
53 }
54
55 public String getTestEndpointURI()
56 {
57 return "https://localhost:60127";
58 }
59
60 public Object getValidMessage() throws Exception
61 {
62 return "Hello".getBytes();
63 }
64
65 public void testValidListener() throws Exception
66 {
67 Service service = getTestService("orange", Orange.class);
68 InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(
69 getTestEndpointURI());
70
71 getConnector().registerListener(endpoint, getSensingNullMessageProcessor(), service);
72 }
73
74 public void testProperties() throws Exception
75 {
76 HttpsConnector c = (HttpsConnector)getConnector();
77
78 c.setSendBufferSize(1024);
79 assertEquals(1024, c.getSendBufferSize());
80 c.setSendBufferSize(0);
81 assertEquals(TcpConnector.DEFAULT_BUFFER_SIZE, c.getSendBufferSize());
82
83
84 }
85 }