Bouncycastle class cast exception introduced in 2.3

We have some Cucumber test implemented with Groovy step definitions. In these steps we use the Groovy http-builder to call some rest services. We are currently running Gradle 2.2.1 and we can run our tests fine, but we have tried to upgrade to Gradle 2.3 and 2.4 and we get failures with the below stack trace

groovyx.net.http.HttpResponseException: cannot create instance of org.bouncycastle.jcajce.provider.symmetric.IDEA$Mappings : java.lang.ClassCastException: org.bouncycastle.jcajce.provider.symmetric.IDEA$Mappings cannot be cast to org.bouncycastle.jcajce.provider.util.AlgorithmProvider

    at groovyx.net.http.RESTClient.defaultFailureHandler(RESTClient.java:263)

    at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:606)

    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)

    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)

    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1208)

   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1075)

    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1017)

    at groovy.lang.Closure.call(Closure.java:423)

    at groovyx.net.http.HTTPBuilder$1.handleResponse(HTTPBuilder.java:503)

    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1070)

    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1044)

    at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)

    at groovyx.net.http.RESTClient.get(RESTClient.java:119)

    at groovyx.net.http.RESTClient$get.call(Unknown Source)

    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)

    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)

    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)

In the underlying code we are using bouncycastle to do some processing of the response which is included as a dependency but it seems to be picking up a different implementation.

Hopefully I will get some time to investigate further later this week.