stomp 1.4.3 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +46 -3
- data/examples/artemis/artlogger.rb +41 -0
- data/examples/artemis/cliwaiter_not_reliable.rb +66 -0
- data/examples/artemis/cliwaiter_reliable.rb +61 -0
- data/examples/contrib.sh +2 -2
- data/examples/examplogger.rb +5 -3
- data/examples/ssl_uc1.rb +4 -2
- data/lib/client/utils.rb +10 -7
- data/lib/connection/heartbeats.rb +13 -11
- data/lib/connection/netio.rb +47 -14
- data/lib/connection/utils.rb +15 -5
- data/lib/stomp/client.rb +13 -6
- data/lib/stomp/connection.rb +10 -6
- data/lib/stomp/constants.rb +6 -4
- data/lib/stomp/errors.rb +25 -2
- data/lib/stomp/version.rb +4 -4
- data/spec/client_spec.rb +33 -18
- data/spec/spec_helper.rb +1 -0
- data/stomp.gemspec +21 -17
- data/test/MultiBrokerUnitTestExample.sh +65 -0
- data/test/test_anonymous.rb +29 -47
- data/test/test_client.rb +131 -131
- data/test/test_connection.rb +49 -51
- data/test/test_connection1p.rb +45 -76
- data/test/test_helper.rb +15 -2
- data/test/test_message.rb +18 -35
- data/test/test_ssl.rb +4 -10
- data/test/unitst.sh +3 -2
- metadata +7 -3
    
        data/lib/connection/utils.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ module Stomp | |
| 11 11 |  | 
| 12 12 | 
             
                private
         | 
| 13 13 |  | 
| 14 | 
            -
                # Support multi-homed servers. | 
| 14 | 
            +
                # Support multi-homed servers.
         | 
| 15 15 | 
             
                def _expand_hosts(hash)
         | 
| 16 16 | 
             
                  new_hash = hash.clone
         | 
| 17 17 | 
             
                  new_hash[:hosts_cloned] = hash[:hosts].clone
         | 
| @@ -137,8 +137,16 @@ module Stomp | |
| 137 137 | 
             
                        rescue Exception => aex
         | 
| 138 138 | 
             
                          raise if aex.is_a?(Stomp::Error::LoggerConnectionError)
         | 
| 139 139 | 
             
                        end
         | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 140 | 
            +
                        if max_reconnect_attempts?
         | 
| 141 | 
            +
                          $stderr.print "In socket() Reached MaxReconnectAttempts"
         | 
| 142 | 
            +
                          ### _dump_threads()
         | 
| 143 | 
            +
                          mt = @parameters[:client_main]
         | 
| 144 | 
            +
                          if !mt.nil?
         | 
| 145 | 
            +
                            mt.raise Stomp::Error::MaxReconnectAttempts
         | 
| 146 | 
            +
                            Thread::exit
         | 
| 147 | 
            +
                          end
         | 
| 148 | 
            +
                          raise Stomp::Error::MaxReconnectAttempts
         | 
| 149 | 
            +
                        end
         | 
| 142 150 | 
             
                        sleep(@reconnect_delay)
         | 
| 143 151 | 
             
                        @connection_attempts += 1
         | 
| 144 152 |  | 
| @@ -236,11 +244,14 @@ module Stomp | |
| 236 244 | 
             
                # __old_receive receives a frame, blocks until the frame is received.
         | 
| 237 245 | 
             
                def __old_receive()
         | 
| 238 246 | 
             
                  # The receive may fail so we may need to retry.
         | 
| 239 | 
            -
                  while  | 
| 247 | 
            +
                  while true
         | 
| 240 248 | 
             
                    begin
         | 
| 241 249 | 
             
                      used_socket = socket()
         | 
| 242 250 | 
             
                      return _receive(used_socket)
         | 
| 243 251 | 
             
                    rescue Stomp::Error::MaxReconnectAttempts
         | 
| 252 | 
            +
                      unless slog(:on_miscerr, log_params, "Reached MaxReconnectAttempts")
         | 
| 253 | 
            +
                        $stderr.print "Reached MaxReconnectAttempts\n"
         | 
| 254 | 
            +
                      end
         | 
| 244 255 | 
             
                      raise
         | 
| 245 256 | 
             
                    rescue
         | 
| 246 257 | 
             
                      @failure = $!
         | 
| @@ -274,4 +285,3 @@ module Stomp | |
| 274 285 | 
             
              end # class Connection
         | 
| 275 286 |  | 
| 276 287 | 
             
            end # module Stomp
         | 
| 277 | 
            -
             | 
    
        data/lib/stomp/client.rb
    CHANGED
    
    | @@ -88,6 +88,8 @@ module Stomp | |
| 88 88 |  | 
| 89 89 | 
             
                  @logger = @parameters[:logger] ||= Stomp::NullLogger.new
         | 
| 90 90 | 
             
                  @start_timeout = @parameters[:start_timeout] || 0
         | 
| 91 | 
            +
                  @parameters[:client_main] = Thread::current
         | 
| 92 | 
            +
                  ## p [ "CLINDBG", @parameters[:client_main] ]
         | 
| 91 93 | 
             
                  check_arguments!()
         | 
| 92 94 |  | 
| 93 95 | 
             
                  # p [ "cldbg01", @parameters ]
         | 
| @@ -170,22 +172,26 @@ module Stomp | |
| 170 172 | 
             
                # which will be used as a callback listener.
         | 
| 171 173 | 
             
                # Accepts a transaction header ( :transaction => 'some_transaction_id' ).
         | 
| 172 174 | 
             
                def subscribe(destination, headers = {})
         | 
| 173 | 
            -
                  raise  | 
| 175 | 
            +
                  raise Stomp::Error::NoListenerGiven unless block_given?
         | 
| 176 | 
            +
                  headers = headers.symbolize_keys
         | 
| 177 | 
            +
                  raise Stomp::Error::DestinationRequired unless destination
         | 
| 174 178 | 
             
                  # use subscription id to correlate messages to subscription. As described in
         | 
| 175 179 | 
             
                  # the SUBSCRIPTION section of the protocol: http://stomp.github.com/.
         | 
| 176 180 | 
             
                  # If no subscription id is provided, generate one.
         | 
| 177 181 | 
             
                  headers = headers.merge(:id => build_subscription_id(destination, headers))
         | 
| 178 182 | 
             
                  if @listeners[headers[:id]]
         | 
| 179 | 
            -
                    raise  | 
| 183 | 
            +
                    raise Stomp::Error::DuplicateSubscription
         | 
| 180 184 | 
             
                  end
         | 
| 181 185 | 
             
                  @listeners[headers[:id]] = lambda {|msg| yield msg}
         | 
| 182 186 | 
             
                  @connection.subscribe(destination, headers)
         | 
| 183 187 | 
             
                end
         | 
| 184 188 |  | 
| 185 189 | 
             
                # Unsubscribe from a subscription by name.
         | 
| 186 | 
            -
                def unsubscribe( | 
| 187 | 
            -
                  headers = headers. | 
| 188 | 
            -
                   | 
| 190 | 
            +
                def unsubscribe(destination, headers = {})
         | 
| 191 | 
            +
                  headers = headers.symbolize_keys
         | 
| 192 | 
            +
                  raise Stomp::Error::DestinationRequired unless destination
         | 
| 193 | 
            +
                  headers = headers.merge(:id => build_subscription_id(destination, headers))
         | 
| 194 | 
            +
                  @connection.unsubscribe(destination, headers)
         | 
| 189 195 | 
             
                  @listeners[headers[:id]] = nil
         | 
| 190 196 | 
             
                end
         | 
| 191 197 |  | 
| @@ -243,6 +249,8 @@ module Stomp | |
| 243 249 | 
             
                # block on receipt.
         | 
| 244 250 | 
             
                # Accepts a transaction header ( :transaction => 'some_transaction_id' ).
         | 
| 245 251 | 
             
                def publish(destination, message, headers = {})
         | 
| 252 | 
            +
                  headers = headers.symbolize_keys
         | 
| 253 | 
            +
                  raise Stomp::Error::DestinationRequired unless destination
         | 
| 246 254 | 
             
                  if block_given?
         | 
| 247 255 | 
             
                    headers = headers.merge(:receipt => register_receipt_listener(lambda {|r| yield r}))
         | 
| 248 256 | 
             
                  end
         | 
| @@ -351,4 +359,3 @@ module Stomp | |
| 351 359 | 
             
              end # Class
         | 
| 352 360 |  | 
| 353 361 | 
             
            end # Module
         | 
| 354 | 
            -
             | 
    
        data/lib/stomp/connection.rb
    CHANGED
    
    | @@ -156,6 +156,7 @@ module Stomp | |
| 156 156 | 
             
                  @transmit_semaphore = Mutex.new
         | 
| 157 157 | 
             
                  @read_semaphore = Mutex.new
         | 
| 158 158 | 
             
                  @socket_semaphore = Mutex.new
         | 
| 159 | 
            +
                  @gets_semaphore = Mutex.new
         | 
| 159 160 |  | 
| 160 161 | 
             
                  @subscriptions = {}
         | 
| 161 162 | 
             
                  @failure = nil
         | 
| @@ -335,12 +336,13 @@ module Stomp | |
| 335 336 |  | 
| 336 337 | 
             
                # Subscribe subscribes to a destination.  A subscription name is required.
         | 
| 337 338 | 
             
                # For Stomp 1.1+ a session unique subscription ID is also required.
         | 
| 338 | 
            -
                def subscribe( | 
| 339 | 
            +
                def subscribe(destination, headers = {}, subId = nil)
         | 
| 339 340 | 
             
                  raise Stomp::Error::NoCurrentConnection if @closed_check && closed?
         | 
| 340 341 | 
             
                  raise Stomp::Error::ProtocolErrorEmptyHeaderKey if headers.has_key?("")
         | 
| 341 342 | 
             
                  raise Stomp::Error::ProtocolErrorEmptyHeaderValue if @protocol == Stomp::SPL_10 && headers.has_value?("")
         | 
| 342 343 | 
             
                  headers = headers.symbolize_keys
         | 
| 343 | 
            -
                   | 
| 344 | 
            +
                  raise Stomp::Error::DestinationRequired unless destination
         | 
| 345 | 
            +
                  headers[:destination] = destination
         | 
| 344 346 | 
             
                  if @protocol >= Stomp::SPL_11
         | 
| 345 347 | 
             
                    raise Stomp::Error::SubscriptionRequiredError if (headers[:id].nil? && subId.nil?)
         | 
| 346 348 | 
             
                    headers[:id] = subId if headers[:id].nil?
         | 
| @@ -350,7 +352,7 @@ module Stomp | |
| 350 352 |  | 
| 351 353 | 
             
                  # Store the subscription so that we can replay if we reconnect.
         | 
| 352 354 | 
             
                  if @reliable
         | 
| 353 | 
            -
                    subId =  | 
| 355 | 
            +
                    subId = destination if subId.nil?
         | 
| 354 356 | 
             
                    raise Stomp::Error::DuplicateSubscription if @subscriptions[subId]
         | 
| 355 357 | 
             
                    @subscriptions[subId] = headers
         | 
| 356 358 | 
             
                  end
         | 
| @@ -360,12 +362,13 @@ module Stomp | |
| 360 362 |  | 
| 361 363 | 
             
                # Unsubscribe from a destination.   A subscription name is required.
         | 
| 362 364 | 
             
                # For Stomp 1.1+ a session unique subscription ID is also required.
         | 
| 363 | 
            -
                def unsubscribe( | 
| 365 | 
            +
                def unsubscribe(destination, headers = {}, subId = nil)
         | 
| 364 366 | 
             
                  raise Stomp::Error::NoCurrentConnection if @closed_check && closed?
         | 
| 365 367 | 
             
                  raise Stomp::Error::ProtocolErrorEmptyHeaderKey if headers.has_key?("")
         | 
| 366 368 | 
             
                  raise Stomp::Error::ProtocolErrorEmptyHeaderValue if @protocol == Stomp::SPL_10 && headers.has_value?("")
         | 
| 367 369 | 
             
                  headers = headers.symbolize_keys
         | 
| 368 | 
            -
                   | 
| 370 | 
            +
                  raise Stomp::Error::DestinationRequired unless destination
         | 
| 371 | 
            +
                  headers[:destination] = destination
         | 
| 369 372 | 
             
                  if @protocol >= Stomp::SPL_11
         | 
| 370 373 | 
             
                    raise Stomp::Error::SubscriptionRequiredError if (headers[:id].nil? && subId.nil?)
         | 
| 371 374 | 
             
                    headers[:id] = subId unless headers[:id]
         | 
| @@ -374,7 +377,7 @@ module Stomp | |
| 374 377 | 
             
                  slog(:on_unsubscribe, log_params, headers)
         | 
| 375 378 | 
             
                  transmit(Stomp::CMD_UNSUBSCRIBE, headers)
         | 
| 376 379 | 
             
                  if @reliable
         | 
| 377 | 
            -
                    subId =  | 
| 380 | 
            +
                    subId = destination if subId.nil?
         | 
| 378 381 | 
             
                    @subscriptions.delete(subId)
         | 
| 379 382 | 
             
                  end
         | 
| 380 383 | 
             
                end
         | 
| @@ -387,6 +390,7 @@ module Stomp | |
| 387 390 | 
             
                  raise Stomp::Error::ProtocolErrorEmptyHeaderKey if headers.has_key?("")
         | 
| 388 391 | 
             
                  raise Stomp::Error::ProtocolErrorEmptyHeaderValue if @protocol == Stomp::SPL_10 && headers.has_value?("")
         | 
| 389 392 | 
             
                  headers = headers.symbolize_keys
         | 
| 393 | 
            +
                  raise Stomp::Error::DestinationRequired unless destination
         | 
| 390 394 | 
             
                  headers[:destination] = destination
         | 
| 391 395 | 
             
                  _headerCheck(headers)
         | 
| 392 396 | 
             
                  slog(:on_publish, log_params, message, headers)
         | 
    
        data/lib/stomp/constants.rb
    CHANGED
    
    | @@ -26,10 +26,10 @@ module Stomp | |
| 26 26 | 
             
              SPL_11 = "1.1"
         | 
| 27 27 | 
             
              SPL_12 = "1.2"
         | 
| 28 28 |  | 
| 29 | 
            -
              # Stomp 1.0 and 1.1
         | 
| 29 | 
            +
              # Stomp 1.0 and 1.1 and 1.2
         | 
| 30 30 | 
             
              SUPPORTED = [SPL_10, SPL_11, SPL_12]
         | 
| 31 31 |  | 
| 32 | 
            -
              #  | 
| 32 | 
            +
              # UTF-8 Encoding Name
         | 
| 33 33 | 
             
              UTF8 = "UTF-8"
         | 
| 34 34 | 
             
              #
         | 
| 35 35 | 
             
              # Octet 0
         | 
| @@ -175,8 +175,10 @@ module Stomp | |
| 175 175 | 
             
                ["SRP-RSA-AES-256-CBC-SHA","TLSv1/SSLv3",256,256],
         | 
| 176 176 | 
             
              ]
         | 
| 177 177 |  | 
| 178 | 
            +
              HAND_SHAKE_DATA = "\x15\x03\x03\x00\x02\x02\n"
         | 
| 179 | 
            +
             | 
| 178 180 | 
             
              original_verbose, $VERBOSE = $VERBOSE, nil # try to shut off warnings
         | 
| 179 | 
            -
             | 
| 181 | 
            +
             | 
| 180 182 | 
             
              # stomp URL regex pattern, for e.g. login:passcode@host:port or host:port
         | 
| 181 183 | 
             
              URL_REPAT = '((([\w~!@#$%^&*()\-+=.?:<>,.]*\w):([\w~!@#$%^&*()\-+=.?:<>,.]*))?@)?([\w\.\-]+):(\d+)'
         | 
| 182 184 |  | 
| @@ -185,5 +187,5 @@ module Stomp | |
| 185 187 | 
             
              FAILOVER_REGEX = /^failover:(\/\/)?\(stomp(\+ssl)?:\/\/#{URL_REPAT}(,stomp(\+ssl)?:\/\/#{URL_REPAT})*\)(\?(.*))?$/
         | 
| 186 188 |  | 
| 187 189 | 
             
              $VERBOSE = original_verbose
         | 
| 188 | 
            -
             | 
| 190 | 
            +
             | 
| 189 191 | 
             
            end # Module Stomp
         | 
    
        data/lib/stomp/errors.rb
    CHANGED
    
    | @@ -5,6 +5,22 @@ module Stomp | |
| 5 5 | 
             
              # Module level container for Stomp gem error classes.
         | 
| 6 6 | 
             
              module Error
         | 
| 7 7 |  | 
| 8 | 
            +
                # NoListenerGiven is raised if:
         | 
| 9 | 
            +
                # * No listener block is passed to Client#subscribe
         | 
| 10 | 
            +
                class NoListenerGiven < RuntimeError
         | 
| 11 | 
            +
                  def message
         | 
| 12 | 
            +
                    "No listener given"
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                # DestinationRequired is raised if:
         | 
| 17 | 
            +
                # * No destination is passed to subscribe, unsubscribe, publish
         | 
| 18 | 
            +
                class DestinationRequired < RuntimeError
         | 
| 19 | 
            +
                  def message
         | 
| 20 | 
            +
                    "Destination required"
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 8 24 | 
             
                # InvalidFormat is raised if:
         | 
| 9 25 | 
             
                # * During frame parsing if a malformed frame is detected.
         | 
| 10 26 | 
             
                class InvalidFormat < RuntimeError
         | 
| @@ -216,7 +232,7 @@ module Stomp | |
| 216 232 | 
             
                  end
         | 
| 217 233 | 
             
                end
         | 
| 218 234 |  | 
| 219 | 
            -
                # LoggerConnectionError is not raised by the gem.  It may be | 
| 235 | 
            +
                # LoggerConnectionError is not raised by the gem.  It may be
         | 
| 220 236 | 
             
                # raised by client logic in callback logger methods to signal
         | 
| 221 237 | 
             
                # that a connection should not proceed.
         | 
| 222 238 | 
             
                class LoggerConnectionError < RuntimeError
         | 
| @@ -298,7 +314,14 @@ module Stomp | |
| 298 314 | 
             
                  end
         | 
| 299 315 | 
             
                end
         | 
| 300 316 |  | 
| 317 | 
            +
                # HandShakeDetectedError is raised if:
         | 
| 318 | 
            +
                # * A normal read detects inbound handskake data
         | 
| 319 | 
            +
                class HandShakeDetectedError < RuntimeError
         | 
| 320 | 
            +
                  def message
         | 
| 321 | 
            +
                    "Handshake data found, possible mismatched port and sslparams"
         | 
| 322 | 
            +
                  end
         | 
| 323 | 
            +
                end
         | 
| 324 | 
            +
             | 
| 301 325 | 
             
              end # module Error
         | 
| 302 326 |  | 
| 303 327 | 
             
            end # module Stomp
         | 
| 304 | 
            -
             | 
    
        data/lib/stomp/version.rb
    CHANGED
    
    | @@ -4,10 +4,10 @@ module Stomp | |
| 4 4 |  | 
| 5 5 | 
             
              # Define the gem version.
         | 
| 6 6 | 
             
              module Version  #:nodoc: all
         | 
| 7 | 
            -
                MAJOR = | 
| 8 | 
            -
                MINOR = | 
| 9 | 
            -
                PATCH =  | 
| 10 | 
            -
                # PATCH = " | 
| 7 | 
            +
                MAJOR = 1
         | 
| 8 | 
            +
                MINOR = 4
         | 
| 9 | 
            +
                PATCH = 4
         | 
| 10 | 
            +
                # PATCH = "4.plvl.001"
         | 
| 11 11 | 
             
                STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
         | 
| 12 12 | 
             
              end
         | 
| 13 13 | 
             
            end
         | 
    
        data/spec/client_spec.rb
    CHANGED
    
    | @@ -132,6 +132,7 @@ describe Stomp::Client do | |
| 132 132 | 
             
              describe "(created with positional params)" do
         | 
| 133 133 | 
             
                before(:each) do
         | 
| 134 134 | 
             
                  @client = Stomp::Client.new('testlogin', 'testpassword', 'localhost', '12345', false)
         | 
| 135 | 
            +
            	  @cli_thread = @client.parameters[:client_main]
         | 
| 135 136 | 
             
                end
         | 
| 136 137 |  | 
| 137 138 | 
             
                it "should properly parse the URL provided" do
         | 
| @@ -140,7 +141,8 @@ describe Stomp::Client do | |
| 140 141 | 
             
                                                                          :host => 'localhost',
         | 
| 141 142 | 
             
                                                                          :port => 12345}],
         | 
| 142 143 | 
             
                                                              :logger => null_logger,
         | 
| 143 | 
            -
                                                              :reliable => false | 
| 144 | 
            +
                                                              :reliable => false,
         | 
| 145 | 
            +
            												:client_main => @cli_thread)
         | 
| 144 146 | 
             
                  Stomp::Client.new('testlogin', 'testpassword', 'localhost', '12345', false)
         | 
| 145 147 | 
             
                end
         | 
| 146 148 |  | 
| @@ -151,6 +153,7 @@ describe Stomp::Client do | |
| 151 153 | 
             
              describe "(created with non-authenticating stomp:// URL and non-TLD host)" do
         | 
| 152 154 | 
             
                before(:each) do
         | 
| 153 155 | 
             
                  @client = Stomp::Client.new('stomp://foobar:12345')
         | 
| 156 | 
            +
            	  @cli_thread = @client.parameters[:client_main]
         | 
| 154 157 | 
             
                end
         | 
| 155 158 |  | 
| 156 159 | 
             
                it "should properly parse the URL provided" do
         | 
| @@ -159,7 +162,8 @@ describe Stomp::Client do | |
| 159 162 | 
             
                                                                          :host => 'foobar',
         | 
| 160 163 | 
             
                                                                          :port => 12345}],
         | 
| 161 164 | 
             
                                                              :logger => null_logger,
         | 
| 162 | 
            -
                                                              :reliable => false | 
| 165 | 
            +
                                                              :reliable => false,
         | 
| 166 | 
            +
            												:client_main => @cli_thread)
         | 
| 163 167 | 
             
                  Stomp::Client.new('stomp://foobar:12345')
         | 
| 164 168 | 
             
                end
         | 
| 165 169 |  | 
| @@ -171,6 +175,7 @@ describe Stomp::Client do | |
| 171 175 |  | 
| 172 176 | 
             
                before(:each) do
         | 
| 173 177 | 
             
                  @client = Stomp::Client.new('stomp://foo-bar:12345')
         | 
| 178 | 
            +
            	  @cli_thread = @client.parameters[:client_main]
         | 
| 174 179 | 
             
                end
         | 
| 175 180 |  | 
| 176 181 | 
             
                it "should properly parse the URL provided" do
         | 
| @@ -179,7 +184,8 @@ describe Stomp::Client do | |
| 179 184 | 
             
                                                                          :host => 'foo-bar',
         | 
| 180 185 | 
             
                                                                          :port => 12345}],
         | 
| 181 186 | 
             
                                                              :logger => null_logger,
         | 
| 182 | 
            -
                                                              :reliable => false | 
| 187 | 
            +
                                                              :reliable => false,
         | 
| 188 | 
            +
            												:client_main => @cli_thread)
         | 
| 183 189 | 
             
                  Stomp::Client.new('stomp://foo-bar:12345')
         | 
| 184 190 | 
             
                end
         | 
| 185 191 |  | 
| @@ -191,6 +197,7 @@ describe Stomp::Client do | |
| 191 197 |  | 
| 192 198 | 
             
                before(:each) do
         | 
| 193 199 | 
             
                  @client = Stomp::Client.new('stomp://test-login:testpasscode@foobar:12345')
         | 
| 200 | 
            +
            	  @cli_thread = @client.parameters[:client_main]
         | 
| 194 201 | 
             
                end
         | 
| 195 202 |  | 
| 196 203 | 
             
                it "should properly parse the URL provided" do
         | 
| @@ -199,7 +206,8 @@ describe Stomp::Client do | |
| 199 206 | 
             
                                                                          :host => 'foobar',
         | 
| 200 207 | 
             
                                                                          :port => 12345}],
         | 
| 201 208 | 
             
                                                              :logger => null_logger,
         | 
| 202 | 
            -
                                                              :reliable => false | 
| 209 | 
            +
                                                              :reliable => false,
         | 
| 210 | 
            +
            												:client_main => @cli_thread)
         | 
| 203 211 | 
             
                  Stomp::Client.new('stomp://test-login:testpasscode@foobar:12345')
         | 
| 204 212 | 
             
                end
         | 
| 205 213 |  | 
| @@ -211,6 +219,7 @@ describe Stomp::Client do | |
| 211 219 |  | 
| 212 220 | 
             
                before(:each) do
         | 
| 213 221 | 
             
                  @client = Stomp::Client.new('stomp://test-login:testpasscode@foo-bar:12345')
         | 
| 222 | 
            +
            	  @cli_thread = @client.parameters[:client_main]
         | 
| 214 223 | 
             
                end
         | 
| 215 224 |  | 
| 216 225 | 
             
                it "should properly parse the URL provided" do
         | 
| @@ -219,7 +228,8 @@ describe Stomp::Client do | |
| 219 228 | 
             
                                                                          :host => 'foo-bar',
         | 
| 220 229 | 
             
                                                                          :port => 12345}],
         | 
| 221 230 | 
             
                                                              :logger => null_logger,
         | 
| 222 | 
            -
                                                              :reliable => false | 
| 231 | 
            +
                                                              :reliable => false,
         | 
| 232 | 
            +
            												:client_main => @cli_thread)
         | 
| 223 233 | 
             
                  Stomp::Client.new('stomp://test-login:testpasscode@foo-bar:12345')
         | 
| 224 234 | 
             
                end
         | 
| 225 235 |  | 
| @@ -231,6 +241,7 @@ describe Stomp::Client do | |
| 231 241 |  | 
| 232 242 | 
             
                before(:each) do
         | 
| 233 243 | 
             
                  @client = Stomp::Client.new('stomp://host.foobar.com:12345')
         | 
| 244 | 
            +
            	  @cli_thread = @client.parameters[:client_main]
         | 
| 234 245 | 
             
                end
         | 
| 235 246 |  | 
| 236 247 | 
             
                after(:each) do
         | 
| @@ -242,7 +253,8 @@ describe Stomp::Client do | |
| 242 253 | 
             
                                                                          :host => 'host.foobar.com',
         | 
| 243 254 | 
             
                                                                          :port => 12345}],
         | 
| 244 255 | 
             
                                                              :logger => null_logger,
         | 
| 245 | 
            -
                                                              :reliable => false | 
| 256 | 
            +
                                                              :reliable => false,
         | 
| 257 | 
            +
            												:client_main => @cli_thread)
         | 
| 246 258 | 
             
                  Stomp::Client.new('stomp://host.foobar.com:12345')
         | 
| 247 259 | 
             
                end
         | 
| 248 260 |  | 
| @@ -254,6 +266,7 @@ describe Stomp::Client do | |
| 254 266 |  | 
| 255 267 | 
             
                before(:each) do
         | 
| 256 268 | 
             
                  @client = Stomp::Client.new('stomp://testlogin:testpasscode@host.foobar.com:12345')
         | 
| 269 | 
            +
            	  @cli_thread = @client.parameters[:client_main]
         | 
| 257 270 | 
             
                end
         | 
| 258 271 |  | 
| 259 272 | 
             
                it "should properly parse the URL provided" do
         | 
| @@ -262,7 +275,8 @@ describe Stomp::Client do | |
| 262 275 | 
             
                                                                          :host => 'host.foobar.com',
         | 
| 263 276 | 
             
                                                                          :port => 12345}],
         | 
| 264 277 | 
             
                                                              :logger => null_logger,
         | 
| 265 | 
            -
                                                              :reliable => false | 
| 278 | 
            +
                                                              :reliable => false,
         | 
| 279 | 
            +
            												:client_main => @cli_thread)
         | 
| 266 280 | 
             
                  Stomp::Client.new('stomp://testlogin:testpasscode@host.foobar.com:12345')
         | 
| 267 281 | 
             
                end
         | 
| 268 282 |  | 
| @@ -272,6 +286,8 @@ describe Stomp::Client do | |
| 272 286 |  | 
| 273 287 | 
             
              describe "(created with failover URL)" do
         | 
| 274 288 | 
             
                before(:each) do
         | 
| 289 | 
            +
            	  @client = Stomp::Client.new('failover://(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost:61617)')
         | 
| 290 | 
            +
            	  @cli_thread = @client.parameters[:client_main]
         | 
| 275 291 | 
             
                  #default options
         | 
| 276 292 | 
             
                  @parameters = {
         | 
| 277 293 | 
             
                    :initial_reconnect_delay => 0.01,
         | 
| @@ -286,17 +302,14 @@ describe Stomp::Client do | |
| 286 302 | 
             
                end
         | 
| 287 303 | 
             
                it "should properly parse a URL with failover://" do
         | 
| 288 304 | 
             
                  url = "failover://(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost:61617)"
         | 
| 289 | 
            -
             | 
| 290 305 | 
             
                  @parameters[:hosts] = [
         | 
| 291 306 | 
             
                    {:login => "login1", :passcode => "passcode1", :host => "localhost", :port => 61616, :ssl => false},
         | 
| 292 307 | 
             
                    {:login => "login2", :passcode => "passcode2", :host => "remotehost", :port => 61617, :ssl => false}
         | 
| 293 308 | 
             
                  ]
         | 
| 294 | 
            -
             | 
| 295 309 | 
             
                  @parameters.merge!({:logger => null_logger})
         | 
| 296 | 
            -
                  
         | 
| 297 310 | 
             
                  expect(Stomp::Connection).to receive(:new).with(@parameters)
         | 
| 298 | 
            -
             | 
| 299 | 
            -
             | 
| 311 | 
            +
            	  @parameters[:client_main] = @cli_thread
         | 
| 312 | 
            +
            	  client = Stomp::Client.new(url)
         | 
| 300 313 | 
             
                  expect(client.parameters).to eq(@parameters)
         | 
| 301 314 | 
             
                end
         | 
| 302 315 |  | 
| @@ -310,9 +323,8 @@ describe Stomp::Client do | |
| 310 323 | 
             
                  ]
         | 
| 311 324 |  | 
| 312 325 | 
             
                  @parameters.merge!({:logger => null_logger})
         | 
| 313 | 
            -
             | 
| 326 | 
            +
            	  @parameters[:client_main] = @cli_thread
         | 
| 314 327 | 
             
                  expect(Stomp::Connection).to receive(:new).with(@parameters)
         | 
| 315 | 
            -
                  
         | 
| 316 328 | 
             
                  client = Stomp::Client.new(url)
         | 
| 317 329 | 
             
                  expect(client.parameters).to eq(@parameters)
         | 
| 318 330 | 
             
                end
         | 
| @@ -326,10 +338,11 @@ describe Stomp::Client do | |
| 326 338 | 
             
                  ]
         | 
| 327 339 |  | 
| 328 340 | 
             
                  @parameters.merge!({:logger => null_logger})
         | 
| 329 | 
            -
                  
         | 
| 341 | 
            +
                  @parameters[:client_main] = @cli_thread
         | 
| 330 342 | 
             
                  expect(Stomp::Connection).to receive(:new).with(@parameters)
         | 
| 331 343 |  | 
| 332 344 | 
             
                  client = Stomp::Client.new(url)
         | 
| 345 | 
            +
            	  @parameters[:client_main] = client.parameters[:client_main]
         | 
| 333 346 | 
             
                  expect(client.parameters).to eq(@parameters)
         | 
| 334 347 | 
             
                end
         | 
| 335 348 |  | 
| @@ -342,10 +355,11 @@ describe Stomp::Client do | |
| 342 355 | 
             
                  ]
         | 
| 343 356 |  | 
| 344 357 | 
             
                  @parameters.merge!({:logger => null_logger})
         | 
| 345 | 
            -
                  
         | 
| 358 | 
            +
                  @parameters[:client_main] = @cli_thread
         | 
| 346 359 | 
             
                  expect(Stomp::Connection).to receive(:new).with(@parameters)
         | 
| 347 360 |  | 
| 348 361 | 
             
                  client = Stomp::Client.new(url)
         | 
| 362 | 
            +
            	  @parameters[:client_main] = client.parameters[:client_main]
         | 
| 349 363 | 
             
                  expect(client.parameters).to eq(@parameters)
         | 
| 350 364 | 
             
                end
         | 
| 351 365 |  | 
| @@ -373,10 +387,11 @@ describe Stomp::Client do | |
| 373 387 | 
             
                  ]
         | 
| 374 388 |  | 
| 375 389 | 
             
                  @parameters.merge!({:logger => null_logger})
         | 
| 376 | 
            -
                  
         | 
| 390 | 
            +
                  @parameters[:client_main] = @cli_thread
         | 
| 377 391 | 
             
                  expect(Stomp::Connection).to receive(:new).with(@parameters)
         | 
| 378 392 |  | 
| 379 393 | 
             
                  client = Stomp::Client.new(url)
         | 
| 394 | 
            +
            	  @parameters[:client_main] = client.parameters[:client_main]
         | 
| 380 395 | 
             
                  expect(client.parameters).to eq(@parameters)
         | 
| 381 396 | 
             
                end
         | 
| 382 397 |  | 
| @@ -419,7 +434,7 @@ describe Stomp::Client do | |
| 419 434 | 
             
                  describe 'given headers hash' do
         | 
| 420 435 | 
             
                    subject { headers }
         | 
| 421 436 | 
             
                    it 'is immutable' do
         | 
| 422 | 
            -
                       | 
| 437 | 
            +
                      expect match(original_headers)
         | 
| 423 438 | 
             
                    end
         | 
| 424 439 | 
             
                  end
         | 
| 425 440 | 
             
                end
         |