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.api;
8   
9   import org.mule.api.security.tls.TlsConfiguration;
10  import org.mule.api.security.tls.TlsPropertiesSocketFactory;
11  import org.mule.tck.junit4.AbstractMuleTestCase;
12  
13  import org.junit.Test;
14  
15  import static org.junit.Assert.assertTrue;
16  
17  public class TlsPropertiesSocketTestCase extends AbstractMuleTestCase
18  {
19  
20      @Test
21      public void testSimpleSocket() throws Exception
22      {
23          TlsConfiguration configuration = new TlsConfiguration(TlsConfiguration.DEFAULT_KEYSTORE);
24          configuration.setKeyPassword("mulepassword");
25          configuration.setKeyStorePassword("mulepassword");
26          configuration.setKeyStore("clientKeystore");
27          configuration.initialise(false, TlsConfiguration.JSSE_NAMESPACE);
28  
29          TlsPropertiesSocketFactory socketFactory = 
30              new TlsPropertiesSocketFactory(true, TlsConfiguration.JSSE_NAMESPACE);
31          assertTrue("socket is useless", socketFactory.getSupportedCipherSuites().length > 0);
32      }
33  
34  }
35  
36