Example #1
0
        protected override ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat)
        {
            Tracer.Debug("Creating new instance of the SSL Transport.");
            SslTransport transport = new SslTransport(location, socket, wireFormat);

            if (this.sslProtocol == null)
            {
                this.sslProtocol = SslContext.GetCurrent().SslProtocol;
            }
            else
            {
                SslContext.GetCurrent().SslProtocol = this.sslProtocol;
            }
            Tracer.DebugFormat("SslProtocol: {0}", this.sslProtocol);

            transport.ClientCertSubject       = HttpUtility.UrlDecode(this.clientCertSubject);
            transport.ClientCertFilename      = this.clientCertFilename;
            transport.ClientCertPassword      = this.clientCertPassword;
            transport.BrokerCertFilename      = this.brokerCertFilename;
            transport.ServerName              = this.serverName;
            transport.KeyStoreLocation        = this.keyStoreLocation;
            transport.KeyStoreName            = this.keyStoreName;
            transport.AcceptInvalidBrokerCert = this.acceptInvalidBrokerCert;
            transport.SslProtocol             = this.sslProtocol;

            return(transport);
        }
Example #2
0
 public StompConnection(Uri brokerUri, ITransportFactory transportFactory, IWireFormat wireFormat, ILogger logger)
 {
     _brokerUri        = brokerUri;
     _transportFactory = transportFactory;
     _wireFormat       = wireFormat;
     _logger           = logger;
 }
        protected override ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat )
        {
            Tracer.Debug("Creating new instance of the TcpFaulty Transport.");
            TcpFaultyTransport transport = new TcpFaultyTransport(location, socket, wireFormat);

            return transport;
        }
Example #4
0
        public ITransport CreateTransport(Uri location)
        {
            // Extract query parameters from broker Uri
            System.Collections.Specialized.StringDictionary map = URISupport.ParseQuery(location.Query);

            // Set transport. properties on this (the factory)
            URISupport.SetProperties(this, map, "transport.");

            // Console.WriteLine("Opening socket to: " + host + " on port: " + port);
            Socket       socket       = Connect(location.Host, location.Port);
            IWireFormat  wireformat   = CreateWireFormat(location, map);
            TcpTransport tcpTransport = new TcpTransport(socket, wireformat);

            wireformat.Transport = tcpTransport;
            ITransport rc = tcpTransport;

            if (UseLogging)
            {
                rc = new LoggingTransport(rc);
            }

            if (wireformat is OpenWireFormat)
            {
                rc = new WireFormatNegotiator(rc, (OpenWireFormat)wireformat);
            }
            rc = new MutexTransport(rc);
            rc = new ResponseCorrelator(rc);

            return(rc);
        }
Example #5
0
    /// <summary>
    ///     Initializes a new instance of the <see cref="TcpTransport" /> class.
    /// </summary>
    /// <exception cref="ArgumentNullException">stompConnectionSettings can not be null.</exception>
    /// <param name="location">The URI.</param>
    /// <param name="socket">The socket to use.</param>
    /// <param name="wireFormat">A <see cref="IWireFormat" />.</param>
    /// <param name="stompConnectionSettings">Some STOMP connection settings.</param>
    public SslTransport(Uri location, Socket socket, IWireFormat wireFormat, [NotNull] StompConnectionSettings stompConnectionSettings)
        : base(location, socket, wireFormat)
    {
        stompConnectionSettings.ThrowIfNull(nameof(stompConnectionSettings));

        _stompConnectionSettings = stompConnectionSettings;
    }
Example #6
0
        protected IWireFormat CreateWireFormat(Uri location, StringDictionary map)
        {
            object      properties    = null;
            IWireFormat wireFormatItf = null;

            // Detect STOMP etc
            if (String.Compare(location.Scheme, "stomp", true) == 0)
            {
                this.wireFormat = "STOMP";
            }

            if (String.Compare(this.wireFormat, "stomp", true) == 0)
            {
                wireFormatItf = new StompWireFormat();
                properties    = wireFormatItf;
            }
            else
            {
                OpenWireFormat openwireFormat = new OpenWireFormat();

                wireFormatItf = openwireFormat;
                properties    = openwireFormat.PreferedWireFormatInfo;
            }

            if (null != properties)
            {
                // Set wireformat. properties on the wireformat owned by the tcpTransport
                URISupport.SetProperties(properties, map, "wireFormat.");
            }

            return(wireFormatItf);
        }
        protected override ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat)
        {
            Tracer.Debug("Creating new instance of the TcpFaulty Transport.");
            TcpFaultyTransport transport = new TcpFaultyTransport(location, socket, wireFormat);

            return(transport);
        }
Example #8
0
        public TcpTransport(Uri uri, Socket socket, IWireFormat wireformat)
        {
            this.connectedUri = uri;
            this.socket       = socket;
            this.wireformat   = wireformat;

            // Apply the buffer sizes to the transport also so that it can buffer above the
            // TCP level which can eagerly send causing sparse packets.
            this.SendBufferSize    = socket.SendBufferSize;
            this.ReceiveBufferSize = socket.ReceiveBufferSize;
        }
Example #9
0
        /// <summary>
        /// Override in a subclass to create the specific type of transport that is
        /// being implemented.
        /// </summary>
        protected virtual ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat)
        {
            TcpTransport transport = new TcpTransport(location, socket, wireFormat);

            // Apply the buffer sizes to the transport also so that it can buffer above the
            // TCP level which can eagerly send causing sparse packets.
            transport.SendBufferSize    = SendBufferSize;
            transport.ReceiveBufferSize = ReceiveBufferSize;

            return(transport);
        }
Example #10
0
		protected override ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat )
		{
            Tracer.Debug("Creating new instance of the SSL Transport.");
			SslTransport transport = new SslTransport(location, socket, wireFormat);

            transport.ClientCertSubject = this.clientCertSubject;
            transport.ClientCertFilename = this.clientCertFilename;
            transport.ClientCertPassword = this.clientCertPassword;
            transport.ServerName = this.serverName;
            transport.KeyStoreLocation = this.keyStoreLocation;
            transport.KeyStoreName = this.keyStoreName;
            transport.AcceptInvalidBrokerCert = this.acceptInvalidBrokerCert;
            
            return transport;
		}		
        protected override ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat)
        {
            Tracer.Debug("Creating new instance of the SSL Transport.");
            SslTransport transport = new SslTransport(location, socket, wireFormat);

            transport.ClientCertSubject       = this.clientCertSubject;
            transport.ClientCertFilename      = this.clientCertFilename;
            transport.ClientCertPassword      = this.clientCertPassword;
            transport.ServerName              = this.serverName;
            transport.KeyStoreLocation        = this.keyStoreLocation;
            transport.KeyStoreName            = this.keyStoreName;
            transport.AcceptInvalidBrokerCert = this.acceptInvalidBrokerCert;

            return(transport);
        }
Example #12
0
        protected IWireFormat CreateWireFormat(StringDictionary map)
        {
            object      properties    = null;
            IWireFormat wireFormatItf = null;

            wireFormatItf = new StompWireFormat();
            properties    = wireFormatItf;

            if (null != properties)
            {
                // Set wireformat. properties on the wireformat owned by the tcpTransport
                URISupport.SetProperties(properties, map, "wireFormat.");
            }

            return(wireFormatItf);
        }
        public ITransport CompositeConnect(Uri location, SetTransport setTransport)
        {
            // Extract query parameters from broker Uri
            StringDictionary map = URISupport.ParseQuery(location.Query);

            // Set transport. properties on this (the factory)
            URISupport.SetProperties(this, map, "transport.");

            Tracer.Debug("Opening socket to: " + location.Host + " on port: " + location.Port);
            Socket socket = Connect(location.Host, location.Port);

#if !NETCF
            socket.ReceiveBufferSize = ReceiveBufferSize;
            socket.SendBufferSize    = SendBufferSize;
            socket.ReceiveTimeout    = ReceiveTimeout;
            socket.SendTimeout       = SendTimeout;
#endif

            IWireFormat wireformat = CreateWireFormat(map);
            ITransport  transport  = new TcpTransport(location, socket, wireformat);

            wireformat.Transport = transport;

            if (UseLogging)
            {
                transport = new LoggingTransport(transport);
            }

            if (UseInactivityMonitor)
            {
                transport = new InactivityMonitor(transport);
            }

            if (wireformat is OpenWireFormat)
            {
                transport = new WireFormatNegotiator(transport, (OpenWireFormat)wireformat);
            }

            transport.RequestTimeout = this.requestTimeout;

            if (setTransport != null)
            {
                setTransport(transport, location);
            }

            return(transport);
        }
Example #14
0
        protected override ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat)
        {
            Tracer.Debug("Creating new instance of the SSL Transport.");
#if !NETCF
            SslTransport transport = new SslTransport(location, socket, wireFormat);

            transport.ClientCertSubject       = this.clientCertSubject;
            transport.ClientCertFilename      = this.clientCertFilename;
            transport.ClientCertPassword      = this.clientCertPassword;
            transport.ServerName              = this.serverName;
            transport.KeyStoreLocation        = this.keyStoreLocation;
            transport.KeyStoreName            = this.keyStoreName;
            transport.AcceptInvalidBrokerCert = this.acceptInvalidBrokerCert;

            return(transport);
#else
            throw new NotSupportedException("SslTransport not implemented on the .NET Compact Framework.");
#endif
        }
Example #15
0
 public TcpFaultyTransport(Uri location, Socket socket, IWireFormat wireFormat) :
     base(location, socket, wireFormat)
 {
 }
Example #16
0
 public SslTransport(Uri location, Socket socket, IWireFormat wireFormat) :
     base(location, socket, wireFormat)
 {
 }
Example #17
0
 /// <summary>
 ///     Override in a subclass to create the specific type of transport that is
 ///     being implemented.
 /// </summary>
 protected virtual ITransport CreateTransport(Uri location, Socket socket, IWireFormat wireFormat)
 => new TcpTransport(location, socket, wireFormat);
Example #18
0
		public TcpTransport(Uri uri, Socket socket, IWireFormat wireformat)
		{
			this.connectedUri = uri;
			this.socket = socket;
			this.wireformat = wireformat;
		}
Example #19
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="TcpTransport" /> class.
 /// </summary>
 /// <param name="uri">The URI.</param>
 /// <param name="socket">The socket to use.</param>
 /// <param name="wireformat">A <see cref="IWireFormat" />.</param>
 public TcpTransport(Uri uri, Socket socket, IWireFormat wireformat)
 {
     RemoteAddress = uri;
     Socket        = socket;
     Wireformat    = wireformat;
 }
Example #20
0
 public SslTransport(Uri location, Socket socket, IWireFormat wireFormat) :
     base(location, socket, wireFormat)
 {
 }
Example #21
0
 protected override ITransport CreateTransport(Uri location, Socket socket, IWireFormat wireFormat)
 => new SslTransport(location, socket, wireFormat, _stompConnectionSettings);
 /// <summary>
 /// Override in a subclass to create the specific type of transport that is
 /// being implemented.
 /// </summary>
 protected virtual ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat )
 {
     return new TcpTransport(location, socket, wireFormat);
 }
Example #23
0
 public TcpTransport(Socket socket, IWireFormat wireformat)
 {
     this.socket     = socket;
     this.wireformat = wireformat;
 }
Example #24
0
        /// <summary>
        /// Override in a subclass to create the specific type of transport that is
        /// being implemented.
        /// </summary>
        protected virtual ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat)
        {
            TcpTransport transport = new TcpTransport(location, socket, wireFormat);

            return(transport);
        }
Example #25
0
 public TcpTransport(Uri uri, Socket socket, IWireFormat wireformat)
 {
     this.connectedUri = uri;
     this.socket       = socket;
     this.wireformat   = wireformat;
 }
Example #26
0
        public TcpTransport(Socket socket, IWireFormat wireformat)
        {
            this.socket = socket;
			this.wireformat = wireformat;
        }
Example #27
0
 public TcpFaultyTransport(Uri location, Socket socket, IWireFormat wireFormat) :
     base(location, socket, wireFormat)
 {
 }