在groovy中绕过ssl证书检查的简单方法

在groovy中绕过ssl证书检查的简单方法,groovy,ssl-certificate,httpurlconnection,Groovy,Ssl Certificate,Httpurlconnection,我使用这个简单的方法进行REST调用,得到以下错误: def connection = new URL( 'someURL.com') .openConnection() as HttpURLConnection connection.setRequestProperty( 'Accept', 'application/json' ) // get the response code - automatically sends the request print

我使用这个简单的方法进行REST调用,得到以下错误:

def connection = new URL( 'someURL.com')
    .openConnection() as HttpURLConnection
    connection.setRequestProperty( 'Accept', 'application/json' )

    // get the response code - automatically sends the request
    println connection.responseCode + ": " + connection.inputStream.text
您能推荐一种简单的方法来绕过SSL证书验证,而不必像使用httpBuilder那样使用它吗

谢谢您的帮助。

可能的副本
    Caught: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at Example.findUserInUsamPGroup(findUserInUsamPGroup.groovy:33)
    at Example.main(findUserInUsamPGroup.groovy:3)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    ... 2 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    ... 2 more