Coverage Report - org.mule.transport.ssl.SslSocketFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
SslSocketFactory
0%
0/8
N/A
3.5
 
 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.ssl;
 8  
 
 9  
 import org.mule.api.security.tls.TlsConfiguration;
 10  
 import org.mule.transport.tcp.AbstractTcpSocketFactory;
 11  
 import org.mule.transport.tcp.TcpSocketKey;
 12  
 
 13  
 import java.io.IOException;
 14  
 import java.net.Socket;
 15  
 import java.security.KeyManagementException;
 16  
 import java.security.NoSuchAlgorithmException;
 17  
 
 18  
 public class SslSocketFactory extends AbstractTcpSocketFactory
 19  
 {
 20  
 
 21  
     private TlsConfiguration tls;
 22  
 
 23  
     public SslSocketFactory(TlsConfiguration tls)
 24  0
     {
 25  0
         this.tls = tls;
 26  0
     }
 27  
 
 28  
     protected Socket createSocket(TcpSocketKey key) throws IOException
 29  
     {
 30  
         try
 31  
         {
 32  0
             return tls.getSocketFactory().createSocket(key.getInetAddress(), key.getPort());
 33  
         }
 34  0
         catch (NoSuchAlgorithmException e)
 35  
         {
 36  0
             throw (IOException) new IOException(e.getMessage()).initCause(e);
 37  
         }
 38  0
         catch (KeyManagementException e)
 39  
         {
 40  0
             throw (IOException) new IOException(e.getMessage()).initCause(e);
 41  
         }
 42  
     }
 43  
 
 44  
 }