Skip to content

Commit

Permalink
Merge pull request #406 from nahi/jruby_socket_refactoring
Browse files Browse the repository at this point in the history
refactoring: code de-duplication
  • Loading branch information
nahi authored Feb 4, 2019
2 parents fcbefca + a5491c7 commit 4d60d8b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/httpclient/jruby_ssl_socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,13 @@ def create_ssl_context(config)
def create_ssl_socket(socket, dest, config, opts)
ctx = create_ssl_context(config)
factory = ctx.getSocketFactory
if socket
ssl_socket = factory.createSocket(socket, dest.host, dest.port, true)
else
unless socket
# Create a plain socket first to set connection timeouts on,
# then wrap it in a SSL socket so that SNI gets setup on it.
socket = javax.net.SocketFactory.getDefault.createSocket
JavaSocketWrap.connect(socket, dest, opts)
ssl_socket = factory.createSocket(socket, dest.host, dest.port, true)
end
ssl_socket
factory.createSocket(socket, dest.host, dest.port, true)
end

def peer_cert
Expand Down

0 comments on commit 4d60d8b

Please sign in to comment.