From dc81c4e2d523e369352c4c99f22aec3e904bc594 Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Fri, 27 Apr 2018 00:06:24 +0300 Subject: [PATCH] Use default Selenium HTTP client factory Usage of default Selenium HTTP client factory brings required level of abstraction, clients rely on the same mechanism as for Selenium WD while choosing HTTP client. The implementation used can be changed by setting the `webdriver.http.factory` system property. --- .../appium/java_client/remote/AppiumCommandExecutor.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java b/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java index 5426de95f..be8843061 100644 --- a/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java +++ b/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java @@ -33,7 +33,6 @@ import org.openqa.selenium.remote.http.HttpClient; import org.openqa.selenium.remote.http.HttpRequest; import org.openqa.selenium.remote.http.W3CHttpCommandCodec; -import org.openqa.selenium.remote.internal.OkHttpClient; import org.openqa.selenium.remote.service.DriverService; import java.io.IOException; @@ -70,12 +69,12 @@ public AppiumCommandExecutor(Map additionalCommands, public AppiumCommandExecutor(Map additionalCommands, URL addressOfRemoteServer) { - this(additionalCommands, addressOfRemoteServer, new OkHttpClient.Factory()); + this(additionalCommands, addressOfRemoteServer, HttpClient.Factory.createDefault()); } public AppiumCommandExecutor(Map additionalCommands, DriverService service) { - this(additionalCommands, service, new OkHttpClient.Factory()); + this(additionalCommands, service, HttpClient.Factory.createDefault()); } private B getPrivateFieldValue(String fieldName, Class fieldType) { @@ -156,4 +155,4 @@ && getCommandCodec() instanceof W3CHttpCommandCodec) { return response; } -} \ No newline at end of file +}