55import java .net .Proxy ;
66import java .util .Map ;
77
8+ import okhttp3 .OkHttpClient ;
9+
810/**
911 * Configuration for a {@link Client} instance.
1012 */
@@ -148,8 +150,21 @@ public void setMaxServerPingDelay(int maxServerPingDelay) {
148150
149151 private int maxServerPingDelay = 10000 ;
150152
153+ public OkHttpClient getOkHttpClient () {
154+ return this .okHttpClient ;
155+ }
156+
157+ /**
158+ * Set OkHttpClient. Can be used to pass configured custom OkHttpClient (with DNS, proxy, SSLSocketFactory etc.).
159+ */
160+ public void setOkHttpClient (OkHttpClient okHttpClient ) {
161+ this .okHttpClient = okHttpClient ;
162+ }
163+
164+ private OkHttpClient okHttpClient ;
165+
151166 /**
152- * Set proxy to use.
167+ * Set proxy to use in default OkHttpClient builder. Won't be used if {@link #setOkHttpClient} was used .
153168 */
154169 public void setProxy (Proxy proxy ) {
155170 this .proxy = proxy ;
@@ -165,7 +180,7 @@ public Proxy getProxy() {
165180 private String proxyPassword ;
166181
167182 /**
168- * Set proxy credentials.
183+ * Set proxy credentials for default OkHttpClient builder. Won't be used if {@link #setOkHttpClient} was used .
169184 */
170185 public void setProxyCredentials (String login , String password ) {
171186 this .proxyLogin = login ;
@@ -185,7 +200,7 @@ public Dns getDns() {
185200 }
186201
187202 /**
188- * Set custom DNS resolver. .
203+ * Set custom DNS resolver for default OkHttpClient builder. Won't be used if {@link #setOkHttpClient} was used .
189204 */
190205 public void setDns (Dns dns ) {
191206 this .dns = dns ;
@@ -194,14 +209,15 @@ public void setDns(Dns dns) {
194209 private Dns dns ;
195210
196211 /**
197- * Set custom SSLSocketFactory
212+ * Set custom SSLSocketFactory for default OkHttpClient builder. Won't be used if {@link #setOkHttpClient} was used.
198213 */
199214 public void setSSLSocketFactory (SSLSocketFactory sslSocketFactory ) {
200215 this .sslSocketFactory = sslSocketFactory ;
201216 }
202217
203218 /**
204- * Set custom SSLSocketFactory and X509TrustManager
219+ * Set custom SSLSocketFactory and X509TrustManager for default OkHttpClient builder.
220+ * Won't be used if {@link #setOkHttpClient} was used.
205221 */
206222 public void setSSLSocketFactory (SSLSocketFactory sslSocketFactory , X509TrustManager trustManager ) {
207223 this .sslSocketFactory = sslSocketFactory ;
0 commit comments