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.http;
8   
9   import org.mule.api.endpoint.OutboundEndpoint;
10  import org.mule.api.transport.Connector;
11  import org.mule.tck.junit4.AbstractMuleTestCase;
12  
13  import java.net.URI;
14  
15  import org.apache.commons.httpclient.HostConfiguration;
16  import org.junit.Assert;
17  import org.junit.Test;
18  import org.mockito.Mockito;
19  
20  public class HttpsClientMessageDispatcherTestCase extends AbstractMuleTestCase
21  {
22  
23      @Test
24      public void getHost() throws Exception
25      {
26          OutboundEndpoint oe = Mockito.mock(OutboundEndpoint.class);
27          Connector connector = Mockito.mock(HttpsConnector.class);
28          Mockito.when(oe.getConnector()).thenReturn(connector);
29          HttpsClientMessageDispatcher dispatcher = new HttpsClientMessageDispatcher(oe);
30  
31          URI uri = new URI("https://www.mulesoft.org/");
32          HostConfiguration hc1 = dispatcher.getHostConfig(uri);
33          HostConfiguration hc2 = dispatcher.getHostConfig(uri);
34          Assert.assertEquals(hc1, hc2);
35      }
36  }