From 613f4121b3c420f469e07ab30b3f1cc3b1517dbf Mon Sep 17 00:00:00 2001 From: Dave Golombek Date: Mon, 23 Oct 2017 12:56:54 -0400 Subject: [PATCH] Improve timeout error during jruby ssl connection This fixes #381 by adding explicit handling for Java::JavaNet::SocketTimeoutException when establishing a JRuby SSL connection. --- lib/httpclient/jruby_ssl_socket.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/httpclient/jruby_ssl_socket.rb b/lib/httpclient/jruby_ssl_socket.rb index 046b498f..f8c2c67b 100644 --- a/lib/httpclient/jruby_ssl_socket.rb +++ b/lib/httpclient/jruby_ssl_socket.rb @@ -491,6 +491,8 @@ def initialize(socket, dest, config, opts = {}) ssl_connect(dest.host) rescue java.security.GeneralSecurityException => e raise OpenSSL::SSL::SSLError.new(e.getMessage) + rescue java.javanet.SocketTimeoutException => e + raise HTTPClient::ConnectTimeoutError.new(e.getMessage) rescue java.io.IOException => e raise OpenSSL::SSL::SSLError.new("#{e.class}: #{e.getMessage}") end