private static ITransportFactory CreateTransportFactory()

in src/main/csharp/Transport/TransportFactory.cs [66:109]


        private static ITransportFactory CreateTransportFactory(Uri location)
        {
            string scheme = location.Scheme;

            if(string.IsNullOrEmpty(scheme))
            {
                throw new NMSConnectionException(String.Format("Transport scheme invalid: [{0}]", location.ToString()));
            }

            ITransportFactory factory = null;

            try
            {
                switch(scheme.ToLower())
                {
                case "failover":
                    factory = new FailoverTransportFactory();
                    break;
                case "tcp":
                    factory = new TcpTransportFactory();
                    break;
                case "ssl":
                    factory = new SslTransportFactory();
                    break;
                default:
                    throw new NMSConnectionException(String.Format("The transport {0} is not supported.", scheme));
                }
            }
            catch(NMSConnectionException)
            {
                throw;
            }
            catch
            {
                throw new NMSConnectionException("Error creating transport.");
            }

            if(null == factory)
            {
                throw new NMSConnectionException("Unable to create a transport.");
            }

            return factory;
        }