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); }
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; }
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); }
/// <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; }
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); }
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; }
/// <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); }
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); }
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); }
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 }
public TcpFaultyTransport(Uri location, Socket socket, IWireFormat wireFormat) : base(location, socket, wireFormat) { }
public SslTransport(Uri location, Socket socket, IWireFormat wireFormat) : base(location, socket, wireFormat) { }
/// <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);
public TcpTransport(Uri uri, Socket socket, IWireFormat wireformat) { this.connectedUri = uri; this.socket = socket; this.wireformat = wireformat; }
/// <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; }
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); }
public TcpTransport(Socket socket, IWireFormat wireformat) { this.socket = socket; this.wireformat = wireformat; }
/// <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); }