Coverage Report - org.mule.transport.ssl.SslServerSocketFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
SslServerSocketFactory
0%
0/15
N/A
0
 
 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.TcpServerSocketFactory;
 11  
 
 12  
 import java.io.IOException;
 13  
 import java.net.InetAddress;
 14  
 import java.net.ServerSocket;
 15  
 import java.net.InetSocketAddress;
 16  
 
 17  
 import javax.net.ServerSocketFactory;
 18  
 
 19  
 public class SslServerSocketFactory extends TcpServerSocketFactory
 20  
 {
 21  
 
 22  
     private TlsConfiguration tls;
 23  
 
 24  
     public SslServerSocketFactory(TlsConfiguration tls)
 25  0
     {
 26  0
         this.tls = tls;
 27  0
     }
 28  
 
 29  
     @Override
 30  
     public ServerSocket createServerSocket(InetAddress address, int port, int backlog, Boolean reuse) throws IOException
 31  
     {
 32  
         try
 33  
         {
 34  0
             ServerSocketFactory ssf = tls.getServerSocketFactory();
 35  0
             return configure(ssf.createServerSocket(), reuse, new InetSocketAddress(address, port), backlog);
 36  
         }
 37  0
         catch (IOException e)
 38  
         {
 39  0
             throw e;
 40  
         }
 41  0
         catch (Exception e)
 42  
         {
 43  0
             throw (IOException) new IOException(e.getMessage()).initCause(e);
 44  
         }
 45  
     }
 46  
 
 47  
     @Override
 48  
     public ServerSocket createServerSocket(int port, int backlog, Boolean reuse) throws IOException
 49  
     {
 50  
         try
 51  
         {
 52  0
             ServerSocketFactory ssf = tls.getServerSocketFactory();
 53  0
             return configure(ssf.createServerSocket(), reuse, new InetSocketAddress(port), backlog);
 54  
         }
 55  0
         catch (IOException e)
 56  
         {
 57  0
             throw e;
 58  
         }
 59  0
         catch (Exception e)
 60  
         {
 61  0
             throw (IOException) new IOException(e.getMessage()).initCause(e);
 62  
         }
 63  
     }
 64  
 
 65  
 }