okhttp

HTTP/2 protocol not working with okhttp

Deadly 提交于 2020-01-01 08:26:07
问题 I am using Retrofit 1.9 with okhttp 2.4.0. So far we have SPDY protocol disabled on server side (I checked it by this ). And enabled protocol on server side is HTTP/2 (I checked it by this). So I was thinking that okhttp will try to make an api call using HTTP/2 (latest one protocol) but it's using HTTP/1.1 on android device 4.2.2 samsung S4 - D/Retrofit : OkHttp-Selected-Protocol: http/1.1 Someone told me that android device doesn't support SPDY until 5.0 (I don't have any proof), so that

HTTP/2 protocol not working with okhttp

孤者浪人 提交于 2020-01-01 08:26:02
问题 I am using Retrofit 1.9 with okhttp 2.4.0. So far we have SPDY protocol disabled on server side (I checked it by this ). And enabled protocol on server side is HTTP/2 (I checked it by this). So I was thinking that okhttp will try to make an api call using HTTP/2 (latest one protocol) but it's using HTTP/1.1 on android device 4.2.2 samsung S4 - D/Retrofit : OkHttp-Selected-Protocol: http/1.1 Someone told me that android device doesn't support SPDY until 5.0 (I don't have any proof), so that

How do you prevent Retrofit from automatically following a 302

巧了我就是萌 提交于 2020-01-01 08:04:22
问题 I have an authentication call that i'm trying to make using Retrofit on Android. The call returns a 302 to either a success or failure page. The original 302 response brings back a session cookie needed to maintain authentication on success, however Retrofit is automatically handing the request off to the redirect url before I get a chance to consume the cookie. Is there a way to prevent following the redirect? Or is there a way to write a response handler on Retrofit that can add the

OkHttp SSLHandshakeException SSL handshake aborted Failure in SSL library, a protocol error

丶灬走出姿态 提交于 2020-01-01 04:57:18
问题 04-23 17:17:38.434 21599-21956/ D/NativeCrypto: ssl=0x0 NativeCrypto_SSL_interrupt 04-23 17:17:38.435 21599-21956/ D/OkHttp: <-- HTTP FAILED: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x635d8808: Failure in SSL library, usually a protocol error error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:744 0x5e6c46fd:0x00000000) Android lower version devices (4.1 - 4.4) gives SSL

POST Streaming Audio over HTTP/2 in Android

血红的双手。 提交于 2019-12-31 00:55:07
问题 Some background: I am trying to develop a voice-related feature on the android app where a user can search using voice and the server sends intermediate results while user is speaking (which in turn updates the UI) and the final result when the query is complete. Since the server accepts only HTTP/2 single socket connection and Android HTTPUrlConnection doesn't support HTTP/2 yet, I am using Retrofit2. I have looked at this, this and this but each example has fixed length data or the size can

Webservice not working in Android Retrofit , but works in Postman and Swift / iOS, Getting 401 Unauthorized

拜拜、爱过 提交于 2019-12-30 08:33:41
问题 BRIEFING BEFORE 'technical stuff' Not new to working with Retrofit but came across this strange behaviour which I am having very hard time to understand and fix, I have two web service, both work fine as expected in Postman and iOS but only one works in Retrofit and not the other, In my defence I can say I am getting (Unauthorized) response,which means I was able to hit the server and get a result In API developer's defence he says it works in Postman and other devices so not a service issue

Retrofit 2/OkHttp: Cancel all running requests

扶醉桌前 提交于 2019-12-30 02:08:12
问题 I'm using Retrofit 2-beta2 with OkHttp 2.7.0. To get the OkHttpClient object from Retrofit I'm using the Retrofit .client() method and to cancel all it's running requests, I'm calling it's cancel(Object tag) method but the requests still keep running and I get a response. Even the client's Dispatcher 's getQueuedCallCount() and getRunningCallCount() return 0 after calling cancel(). Is there anything else that I need to do for this to work? Or could it be a bug in OkHttp? As a workaround, I'm

OKHttp源码解读

99封情书 提交于 2019-12-29 12:27:15
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> OKHttp源码解读 本次分享主要目标 1.大概流程解读,同步流程,异步流程 2.Interceptor简读 一、OKHttp的简单使用 private String get(String url) throws IOException { Request request = new Request.Builder() .url(url) .build(); Response response = client.newCall(request).execute(); return response.body().string(); } private void useOkHttp() throws IOException { //1.创建OkHttpClient对象 OkHttpClient okhttp = new OkHttpClient.Builder() .readTimeout(15, TimeUnit.SECONDS) .writeTimeout(15, TimeUnit.SECONDS) .build(); //2.创建请求对象Request Request request = new Request.Builder() .url("url") .addHeader("key","value")

not able to import com.squareup.okhttp.OkHttpClient;

三世轮回 提交于 2019-12-28 21:54:43
问题 I am working on android studio and fetching some data from the web. I tried using OkHttpClient and also added jars to my project folder but still i am unable to import it. It shows can't resolve symbol okhttp . I tried some solution but unable to solve the problem.Here is my build.gradle file apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.0" defaultConfig { applicationId "com.example.app" minSdkVersion 14 targetSdkVersion 23 versionCode 1

not able to import com.squareup.okhttp.OkHttpClient;

女生的网名这么多〃 提交于 2019-12-28 21:54:31
问题 I am working on android studio and fetching some data from the web. I tried using OkHttpClient and also added jars to my project folder but still i am unable to import it. It shows can't resolve symbol okhttp . I tried some solution but unable to solve the problem.Here is my build.gradle file apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.0" defaultConfig { applicationId "com.example.app" minSdkVersion 14 targetSdkVersion 23 versionCode 1