Coverage Report - org.mule.endpoint.SocketEndpointURIBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
SocketEndpointURIBuilder
0%
0/11
0%
0/6
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.endpoint;
 8  
 
 9  
 import org.mule.api.endpoint.MalformedEndpointException;
 10  
 
 11  
 import java.net.URI;
 12  
 import java.util.Properties;
 13  
 
 14  
 /**
 15  
  * <code>SocketEndpointBuilder</code> builds an endpointUri based on host and port
 16  
  * only
 17  
  */
 18  0
 public class SocketEndpointURIBuilder extends AbstractEndpointURIBuilder
 19  
 {
 20  
     protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
 21  
     {
 22  
         // set the endpointUri to be a proper url if host and port are set
 23  0
         if (uri.getPort() == -1)
 24  
         {
 25  
             // try the form tcp://6666
 26  
             try
 27  
             {
 28  0
                 int port = Integer.parseInt(uri.getHost());
 29  0
                 this.address = uri.getScheme() + "://localhost:" + port;
 30  
             }
 31  0
             catch (NumberFormatException e)
 32  
             {
 33  
                 // ignore
 34  0
             }
 35  
         }
 36  
 
 37  0
         if (address == null)
 38  
         {
 39  0
             this.address = uri.getScheme() + "://" + uri.getHost();
 40  0
             if (uri.getPort() != -1)
 41  
             {
 42  0
                 this.address += ":" + uri.getPort();
 43  
             }
 44  
         }
 45  0
     }
 46  
 }