Skip to content

Commit

Permalink
Initial bits TLS support
Browse files Browse the repository at this point in the history
Testing this will require a special CA and client cert setup which
we cannot just borrow from amqp gem (the cert there is expired). I will
come around this later.
  • Loading branch information
michaelklishin committed Nov 10, 2012
1 parent d47fc50 commit 62a7be1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/hot_bunnies.rb
Expand Up @@ -26,6 +26,17 @@ def self.connect(options={})
cf.requested_heartbeat = heartbeat_from(options) if include_heartbeat?(options) cf.requested_heartbeat = heartbeat_from(options) if include_heartbeat?(options)
cf.connection_timeout = connection_timeout_from(options) if include_connection_timeout?(options) cf.connection_timeout = connection_timeout_from(options) if include_connection_timeout?(options)


case (options[:ssl] || options[:tls])
when true then
cf.use_ssl_protocol
when String then
if options[:trust_manager]

else
cf.use_ssl_protocol(options[:tls_protocol] || options[:ssl_protocol], options[:trust_manager])
end
end

cf.new_connection cf.new_connection
end end


Expand Down
9 changes: 8 additions & 1 deletion spec/integration/connection_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper" require "spec_helper"




describe "HotBunnies" do describe "HotBunnies.connect" do


# #
# Examples # Examples
Expand All @@ -16,4 +16,11 @@
c1 = HotBunnies.connect(:connection_timeout => 3) c1 = HotBunnies.connect(:connection_timeout => 3)
c1.close c1.close
end end

if !ENV["CI"] && ENV["TLS_TESTS"]
it "supports TLS w/o custom protocol or trust manager" do
c1 = HotBunnies.connect(:tls => true, :port => 5671)
c1.close
end
end
end end

0 comments on commit 62a7be1

Please sign in to comment.