This code was found in a post by Andreas Sterbenz in the now-defunct Sun blogs, the original post can be found at the WayBack Machine. I've used this util many times to "fix" SSLHandshakeException ...