|
27 | 27 | import com.jaspersoft.android.sdk.network.entity.type.GsonFactory;
|
28 | 28 | import com.squareup.okhttp.Authenticator;
|
29 | 29 | import com.squareup.okhttp.OkHttpClient;
|
| 30 | + |
30 | 31 | import org.jetbrains.annotations.NotNull;
|
31 | 32 | import org.jetbrains.annotations.Nullable;
|
32 | 33 |
|
33 | 34 | import java.net.CookieHandler;
|
34 | 35 | import java.net.Proxy;
|
35 | 36 | import java.util.concurrent.TimeUnit;
|
36 | 37 |
|
| 38 | +import javax.net.ssl.HostnameVerifier; |
| 39 | +import javax.net.ssl.SSLSocketFactory; |
| 40 | + |
37 | 41 | /**
|
38 | 42 | * Represents particular Server configuration.
|
39 | 43 | * With corresponding API you can configure two types of clients.
|
@@ -144,6 +148,31 @@ public Builder withProxy(Proxy proxy) {
|
144 | 148 | return this;
|
145 | 149 | }
|
146 | 150 |
|
| 151 | + |
| 152 | + /** |
| 153 | + * Sets the verifier used to confirm that response certificates apply to |
| 154 | + * requested hostnames for HTTPS connections. |
| 155 | + * |
| 156 | + * @param hostnameVerifier your hostname verifier |
| 157 | + * @return builder for convenient configuration |
| 158 | + */ |
| 159 | + public Builder withHostnameVerifier(HostnameVerifier hostnameVerifier) { |
| 160 | + mOkHttpClient.setHostnameVerifier(hostnameVerifier); |
| 161 | + return this; |
| 162 | + } |
| 163 | + |
| 164 | + /** |
| 165 | + *Sets the socket factory used to secure HTTPS connections. |
| 166 | + *If unset, a lazily created SSL socket factory will be used. |
| 167 | + * |
| 168 | + * @param sslSocketFactory your ssl socket factory |
| 169 | + * @return builder for convenient configuration |
| 170 | + */ |
| 171 | + public Builder withSslSocketFactory(SSLSocketFactory sslSocketFactory) { |
| 172 | + mOkHttpClient.setSslSocketFactory(sslSocketFactory); |
| 173 | + return this; |
| 174 | + } |
| 175 | + |
147 | 176 | public Server build() {
|
148 | 177 | Utils.checkNotNull(mBaseUrl, "Server can not be created with null base url");
|
149 | 178 |
|
|
0 commit comments