Permalink
Browse files

Initial bits TLS support

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...
1 parent d47fc50 commit 62a7be15edfd0afc59faeacd9b63d470a23b2a98 @michaelklishin michaelklishin committed Nov 10, 2012
Showing with 19 additions and 1 deletion.
  1. +11 −0 lib/hot_bunnies.rb
  2. +8 −1 spec/integration/connection_spec.rb
View
11 lib/hot_bunnies.rb
@@ -26,6 +26,17 @@ def self.connect(options={})
cf.requested_heartbeat = heartbeat_from(options) if include_heartbeat?(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
end
View
9 spec/integration/connection_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
-describe "HotBunnies" do
+describe "HotBunnies.connect" do
#
# Examples
@@ -16,4 +16,11 @@
c1 = HotBunnies.connect(:connection_timeout => 3)
c1.close
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

0 comments on commit 62a7be1

Please sign in to comment.