Upgrade OkHttp client to 3.12.8
DELETE
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/utils/OkHttpUtils.groovy
-package datadog.trace.agent.test.utils
-
-import okhttp3.OkHttpClient
-
-import java.util.concurrent.TimeUnit
-
-class OkHttpUtils {
-
- static clientBuilder() {
- def unit = TimeUnit.MINUTES
- new OkHttpClient.Builder()
- .connectTimeout(1, unit)
- .writeTimeout(1, unit)
- .readTimeout(1, unit)
- }
-
- static client(boolean followRedirects = false) {
- clientBuilder().followRedirects(followRedirects).build()
- }
-}

ADD
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/utils/OkHttpUtils.java
+package datadog.trace.agent.test.utils;
+
+import java.util.concurrent.TimeUnit;
+import okhttp3.OkHttpClient;
+
+/**
+ * This class was moved from groovy to java because groovy kept trying to introspect on the
+ * OkHttpClient class which contains java 8 only classes, which caused the build to fail for java 7.
+ */
+public class OkHttpUtils {
+
+ static OkHttpClient.Builder clientBuilder() {
+ final TimeUnit unit = TimeUnit.MINUTES;
+ return new OkHttpClient.Builder()
+ .connectTimeout(1, unit)
+ .writeTimeout(1, unit)
+ .readTimeout(1, unit);
+ }
+
+ public static OkHttpClient client() {
+ return client(false);
+ }
+
+ public static OkHttpClient client(final boolean followRedirects) {
+ return clientBuilder().followRedirects(followRedirects).build();
+ }
+}

MODIFY
dd-java-agent/testing/src/test/groovy/server/ServerTest.groovy
dd-java-agent/testing/src/test/groovy/server/ServerTest.groovy
@@ -231,7 +231,7 @@ class ServerTest extends AgentTestRunner {
def "server redirect"() {
setup:
- client = OkHttpUtils.clientBuilder().followRedirects(followRedirects).build()
+ client = OkHttpUtils.client(followRedirects)
def server = httpServer {
handlers {
get("/redirect") {

MODIFY
dd-trace-ot/dd-trace-ot.gradle
dd-trace-ot/dd-trace-ot.gradle
@@ -38,8 +38,8 @@ dependencies {
compile group: 'com.datadoghq', name: 'java-dogstatsd-client', version: '2.1.1'
compile deps.slf4j
+ compile deps.okhttp
compile group: 'org.msgpack', name: 'msgpack-core', version: '0.8.20'
- compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.11.0' // Last version to support Java7
compile group: 'com.squareup.moshi', name: 'moshi', version: '1.9.2'
compile group: 'com.github.jnr', name: 'jnr-unixsocket', version: '0.23'
compile group: 'com.lmax', name: 'disruptor', version: '3.4.2'

MODIFY
gradle/dependencies.gradle
gradle/dependencies.gradle
@@ -7,6 +7,7 @@ ext {
slf4j : "1.7.29",
guava : "20.0", // Last version to support Java 7
+ okhttp : "3.12.8", // 3.12.x is last version to support Java7)
spock : "1.3-groovy-$spockGroovyVer",
groovy : groovyVer,
@@ -31,8 +32,9 @@ ext {
// General
slf4j : "org.slf4j:slf4j-api:${versions.slf4j}",
guava : "com.google.guava:guava:$versions.guava",
- bytebuddy : dependencies.create(group: 'net.bytebuddy', name: 'byte-buddy', version: "${versions.bytebuddy}"),
- bytebuddyagent : dependencies.create(group: 'net.bytebuddy', name: 'byte-buddy-agent', version: "${versions.bytebuddy}"),
+ okhttp : dependencies.create(group: 'com.squareup.okhttp3', name: 'okhttp', version: versions.okhttp),
+ bytebuddy : dependencies.create(group: 'net.bytebuddy', name: 'byte-buddy', version: versions.bytebuddy),
+ bytebuddyagent : dependencies.create(group: 'net.bytebuddy', name: 'byte-buddy-agent', version: versions.bytebuddy),
autoservice : [
dependencies.create(group: 'com.google.auto.service', name: 'auto-service', version: '1.0-rc3'),
dependencies.create(group: 'com.google.auto', name: 'auto-common', version: '0.8'),

Upgrade OkHttp client to 3.12.8