Sha256: 4ce5d327497e93a08a2fce3b69616436a076302a43b0f1fd22b704724697667e

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

# -*- encoding: utf-8 -*-

#
# Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
#
require "rubygems"
require "stomp"
#
# == Demo override of SSLContext.new parameters.
#
# Based roughly on example ssl_uc1.rb.
#
#
class ExampleSSLNewParm
  # Initialize.
  def initialize
  end
  # Run example.
  def run
    ssl_opts = Stomp::SSLParams.new
    hash = { :hosts => [
        {:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
      ],
      :reliable => false, # YMMV, to test this in a sane manner
      :sslctx_newparm => :SSLv2,  # An example should you:
      # a) Actually want SSLv2 *AND*
      # b) Your Ruby version supports SSLv2 *AND*
      # c) Your broker supports and allows SSLv2
    }
    #
    puts "Connect starts, SSL Use Case 1"
    c = Stomp::Connection.new(hash)
    puts "Connect completed"
    puts "SSL Verify Result: #{ssl_opts.verify_result}"
    # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
    #
    c.disconnect
  end
end
#
e = ExampleSSLNewParm.new
e.run

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stomp-1.4.4 examples/ssl_newparm.rb
stomp-1.4.3 examples/ssl_newparm.rb
stomp-1.4.2 examples/ssl_newparm.rb
stomp-1.4.1 examples/ssl_newparm.rb
stomp-1.4.0 examples/ssl_newparm.rb
stomp-1.3.5 examples/ssl_newparm.rb
stomp-1.3.4 examples/ssl_newparm.rb