Fixed en error preventing Thrift::NonblockingServer from working with SSL
diff --git a/lib/rb/spec/ssl_socket_spec.rb b/lib/rb/spec/ssl_socket_spec.rb
index 808d8d5..eb68bcf 100644
--- a/lib/rb/spec/ssl_socket_spec.rb
+++ b/lib/rb/spec/ssl_socket_spec.rb
@@ -35,6 +35,7 @@
allow(@handle).to receive(:connect_nonblock)
allow(@handle).to receive(:close)
allow(@handle).to receive(:post_connection_check)
+ allow(@handle).to receive(:to_io).and_return(@simple_socket_handle)
allow(::Socket).to receive(:new).and_return(@simple_socket_handle)
allow(OpenSSL::SSL::SSLSocket).to receive(:new).and_return(@handle)
@@ -71,6 +72,15 @@
expect(Thrift::SSLSocket.new('localhost', 8080, 5, @context).ssl_context).to eq(@context)
end
+ it "should delegate to_io to the underlying SSL socket handle" do
+ @socket.open
+ expect(@socket.to_io).to eq(@simple_socket_handle)
+ end
+
+ it "should raise IOError when to_io is called on a closed stream" do
+ expect { @socket.to_io }.to raise_error(IOError, 'closed stream')
+ end
+
it "should provide a reasonable to_s" do
expect(Thrift::SSLSocket.new('myhost', 8090).to_s).to eq("ssl(socket(myhost:8090))")
end