code: public static ImmutableEndpoint getImmutableEndpoint(MuleContext muleContext, String endpointName) throws IOException {
  		ImmutableEndpoint endpoint = null;
  
  		Object o = muleContext.getRegistry().lookupObject(endpointName);
  		if (o instanceof ImmutableEndpoint) {
  			// For Inbound and Outbound Endpoints
  			endpoint = (ImmutableEndpoint) o;
  
  		} else if (o instanceof EndpointBuilder) {
  			// For Endpoint-references
  			EndpointBuilder eb = (EndpointBuilder) o;
  			try {
  				endpoint = eb.buildInboundEndpoint();
  			} catch (Exception e) {
  				throw new IOException(e.getMessage());
  			}
  		}
  		return endpoint;
  	}
docs: Lookup an ImmutableEndpoint based on its name
  
  @param muleContext
  @param endpointName
  @return
  @throws IOException