diff --git a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/PatrolAppServiceClient.kt b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/PatrolAppServiceClient.kt index 0bd9b9d92..58f7de84c 100644 --- a/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/PatrolAppServiceClient.kt +++ b/packages/patrol/android/src/main/kotlin/pl/leancode/patrol/contracts/PatrolAppServiceClient.kt @@ -7,11 +7,18 @@ package pl.leancode.patrol.contracts; import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import okhttp3.OkHttpClient -import org.http4k.client.OkHttp +import org.http4k.client.JavaHttpClient +import org.http4k.core.HttpHandler import org.http4k.core.Method import org.http4k.core.Request import org.http4k.core.Status +import org.http4k.core.then +import org.http4k.filter.DebuggingFilters.PrintResponse +//import okhttp3.OkHttpClient +//import org.http4k.client.OkHttp +//import org.http4k.core.Method +//import org.http4k.core.Request +//import org.http4k.core.Status import java.time.Duration import java.util.concurrent.TimeUnit @@ -33,16 +40,20 @@ class PatrolAppServiceClient(address: String, port: Int, private val timeout: Lo request = request.body(requestBody) } - val okHttpClient = OkHttp( - OkHttpClient.Builder() - .connectTimeout(timeout, timeUnit) - .readTimeout(timeout, timeUnit) - .writeTimeout(timeout, timeUnit) - .callTimeout(timeout, timeUnit) - .build() - ) + val client = JavaHttpClient() - val response = okHttpClient(request) + // val printingClient = PrintResponse().then(client) + +// val okHttpClient = OkHttp( +// OkHttpClient.Builder() +// .connectTimeout(timeout, timeUnit) +// .readTimeout(timeout, timeUnit) +// .writeTimeout(timeout, timeUnit) +// .callTimeout(timeout, timeUnit) +// .build() +// ) + + val response = client(request) if (response.status != Status.OK) { throw PatrolAppServiceClientException("Invalid response ${response.status}, ${response.bodyString()}")