Sha256: 2a65ba2b68418a6876aa90c35f4ede7391c4c072330141144d8e9ef09b3bb75a

Contents?: true

Size: 1.38 KB

Versions: 34

Compression:

Stored size: 1.38 KB

Contents

#!/usr/bin/env ruby
# encoding: utf-8

examples_dir = File.join(File.dirname(File.expand_path(__FILE__)), "..", "..")
__dir        = File.join(File.dirname(File.expand_path(__FILE__)), "..")
require File.join(__dir, "example_helper")

certificate_chain_file_path  = File.join(examples_dir, "tls_certificates", "client", "cert.pem")
client_private_key_file_path = File.join(examples_dir, "tls_certificates", "client", "key.pem")

EM.run do
  AMQ::Client::EventMachineClient.connect(:port     => 5671,
                                          :vhost    => "/amq_client_testbed",
                                          :user     => "amq_client_gem",
                                          :password => "amq_client_gem_password",
                                          :ssl => {
                                            :cert_chain_file  => certificate_chain_file_path,
                                            :private_key_file => client_private_key_file_path
                                          }) do |client|
    puts "Connected, authenticated. TLS seems to work."

    client.disconnect { puts "Now closing the connection…"; EM.stop }
  end


  show_stopper = Proc.new {
    EM.stop
  }

  Signal.trap "INT",  show_stopper
  Signal.trap "TERM", show_stopper

  # TLS connections take forever and a day
  # (compared to non-TLS connections) to estabilish.
  EM.add_timer(8, show_stopper)
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha35 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha34 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha33 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha32 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha31 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha30 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha29 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha28 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha27 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha26 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha25 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha24 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha23 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha22 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha21 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha20 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha19 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha18 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha17 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
amq-client-0.7.0.alpha16 examples/eventmachine_adapter/tls/tls_without_peer_verification.rb