Coverage Report - org.mule.transport.ssl.SslSocketFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
SslSocketFactory
50%
4/8
N/A
3.5
 
 1  
 /*
 2  
  * $Id: SslSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.transport.ssl;
 12  
 
 13  
 import org.mule.api.security.tls.TlsConfiguration;
 14  
 import org.mule.transport.tcp.AbstractTcpSocketFactory;
 15  
 import org.mule.transport.tcp.TcpSocketKey;
 16  
 
 17  
 import java.io.IOException;
 18  
 import java.net.Socket;
 19  
 import java.security.KeyManagementException;
 20  
 import java.security.NoSuchAlgorithmException;
 21  
 
 22  
 public class SslSocketFactory extends AbstractTcpSocketFactory
 23  
 {
 24  
 
 25  
     private TlsConfiguration tls;
 26  
 
 27  
     public SslSocketFactory(TlsConfiguration tls)
 28  58
     {
 29  58
         this.tls = tls;
 30  58
     }
 31  
 
 32  
     protected Socket createSocket(TcpSocketKey key) throws IOException
 33  
     {
 34  
         try
 35  
         {
 36  420
             return tls.getSocketFactory().createSocket(key.getInetAddress(), key.getPort());
 37  
         }
 38  0
         catch (NoSuchAlgorithmException e)
 39  
         {
 40  0
             throw (IOException) new IOException(e.getMessage()).initCause(e);
 41  
         }
 42  0
         catch (KeyManagementException e)
 43  
         {
 44  0
             throw (IOException) new IOException(e.getMessage()).initCause(e);
 45  
         }
 46  
     }
 47  
 
 48  
 }