Skip to content

Commit

Permalink
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/test/ruby/ssl/test_socket.rb
Original file line number Diff line number Diff line change
@@ -45,13 +45,27 @@ def test_attr_methods

def test_sync_close_without_connect
require 'socket'
Socket.open(:INET, :STREAM) do |socket|
assert ! socket.closed?
ssl = OpenSSL::SSL::SSLSocket.new(socket)
ssl.sync_close = true
assert ! ssl.closed?
ssl.close
assert socket.closed?
if RUBY_VERSION > '2.2'
Socket.open(:INET, :STREAM) do |socket|
assert ! socket.closed?
ssl = OpenSSL::SSL::SSLSocket.new(socket)
ssl.sync_close = true
assert ! ssl.closed?
ssl.close
assert socket.closed?
end
else
begin
socket = Socket.new :INET, :STREAM
assert ! socket.closed?
ssl = OpenSSL::SSL::SSLSocket.new(socket)
ssl.sync_close = true
assert ! ssl.closed?
ssl.close
assert socket.closed?
ensure
socket && socket.close rescue nil
end
end
end

@@ -69,6 +83,6 @@ def test_ssl_sysread_blocking_error
assert_equal "abc\n", buf
end
end
end if RUBY_VERSION > '2.0'
end if RUBY_VERSION > '2.2'

end

0 comments on commit 12a7980

Please sign in to comment.