File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -153,4 +153,36 @@ def test_read_nonblock_would_block
153
153
end
154
154
end if RUBY_VERSION > '1.9'
155
155
156
+ def test_connect_nonblock_would_block
157
+ start_server ( PORT , OpenSSL ::SSL ::VERIFY_NONE , true ) do |server , port |
158
+ sock = TCPSocket . new ( "127.0.0.1" , port )
159
+ ssl = OpenSSL ::SSL ::SSLSocket . new ( sock )
160
+
161
+ if defined? OpenSSL ::SSL ::SSLErrorWaitReadable
162
+ begin
163
+ ssl . connect_nonblock
164
+ fail 'read would block error not raised!'
165
+ rescue OpenSSL ::SSL ::SSLErrorWaitReadable => e
166
+ assert_equal 'read would block' , e . message
167
+ end
168
+ else
169
+ begin
170
+ ssl . connect_nonblock
171
+ fail 'read would block error not raised!'
172
+ rescue => e
173
+ assert_equal 'read would block' , e . message
174
+ end
175
+ end
176
+
177
+ if RUBY_VERSION > '2.2'
178
+ result = eval "ssl.connect_nonblock(exception: false)"
179
+ assert_equal :wait_readable , result
180
+ end
181
+ result = ssl . connect_nonblock ( :exception => false )
182
+ assert_equal :wait_readable , result
183
+
184
+ ssl . close
185
+ end
186
+ end if RUBY_VERSION > '1.9'
187
+
156
188
end
You can’t perform that action at this time.
0 commit comments