Skip to content

Commit

Permalink
Updates test to init SSL context on client too
Browse files Browse the repository at this point in the history
Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>
  • Loading branch information
Jesus and MSP-Greg committed Jul 25, 2019
1 parent 0c4c96a commit a0b48ee
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/test_puma_server_ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ def test_url_scheme_for_https

def test_request_wont_block_thread
# Open a connection and give enough data to trigger a read, then wait
socket = TCPSocket.new @host, @port
socket.write "x" # We send a single byte and we'll later close the socket,
# this isn't enough data to process a SSL Client Hello.
# Therefore, this will cause our SSL implementation to try
# to read more from the socket before rejecting the
# connection due to an error in handshake.
sleep 1
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
socket = OpenSSL::SSL::SSLSocket.new TCPSocket.new(@host, @port), ctx
socket.write "x"
sleep 0.1

# Capture the amount of threads being used after connecting and being idle
thread_pool = @server.instance_variable_get(:@thread_pool)
Expand Down

0 comments on commit a0b48ee

Please sign in to comment.