File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,27 @@ def test_attr_methods
45
45
46
46
def test_sync_close_without_connect
47
47
require 'socket'
48
- Socket . open ( :INET , :STREAM ) do |socket |
49
- assert ! socket . closed?
50
- ssl = OpenSSL ::SSL ::SSLSocket . new ( socket )
51
- ssl . sync_close = true
52
- assert ! ssl . closed?
53
- ssl . close
54
- assert socket . closed?
48
+ if RUBY_VERSION > '2.2'
49
+ Socket . open ( :INET , :STREAM ) do |socket |
50
+ assert ! socket . closed?
51
+ ssl = OpenSSL ::SSL ::SSLSocket . new ( socket )
52
+ ssl . sync_close = true
53
+ assert ! ssl . closed?
54
+ ssl . close
55
+ assert socket . closed?
56
+ end
57
+ else
58
+ begin
59
+ socket = Socket . new :INET , :STREAM
60
+ assert ! socket . closed?
61
+ ssl = OpenSSL ::SSL ::SSLSocket . new ( socket )
62
+ ssl . sync_close = true
63
+ assert ! ssl . closed?
64
+ ssl . close
65
+ assert socket . closed?
66
+ ensure
67
+ socket && socket . close rescue nil
68
+ end
55
69
end
56
70
end
57
71
@@ -69,6 +83,6 @@ def test_ssl_sysread_blocking_error
69
83
assert_equal "abc\n " , buf
70
84
end
71
85
end
72
- end if RUBY_VERSION > '2.0 '
86
+ end if RUBY_VERSION > '2.2 '
73
87
74
88
end
You can’t perform that action at this time.
0 commit comments