Closed shubham-m closed 8 years ago
Can you reproduce this every time? I've noticed that the Apple gateways are down are at random times.
I got this exception every time. The exceptions are exactly same with the issue described above.
I'm not certain about how to reproduce this issue here. Perhaps you could create a new issue on the okHttp project?
I am also able to replicate this issue 100% of the time, while testing using cURL+nghttp2 works (so it isn't that the server is down).
That's very weird. How are you loading your certificate?
Exactly like the example, using a FileInputStream.
It appears to be loading the certificate properly, cert.available() returns the proper size of the certificate and intentionally using an expired certificate generates a different exception for me.
Could you send me your sandbox certificate? I could take a look here
I have the same issue. Is there any solution?
A sandbox certificate would help, as there's no way in which I can reproduce it here.
Unfortunately, I can't share mine as it is for work. Hopefully someone else is able to.
okhttp3
in HTTP/1x mode , you can see the exception .okhttp3.internal.http.Http1xStream.readResponse(Http1xStream.java:184)
Yes, Apple supports only HTTP/2.
@judepereira I have similar issue, does that mean that my certificate / APN Auth Key are not properly created or initialized?
btw, it works using curl
command mentioned here: http://stackoverflow.com/questions/35603331/curl-http2-request
@darklynx Please open a new issue along with your code for sending the notification.
@judepereira I figured out the cause of the problem. I'm surprised that nobody mentioned about it here.
In order HTTP/2 to work properly with Java 8 one need to supply ALPN support by using Jetty alpn-boot project, as described here: https://github.com/square/okhttp/wiki/Building
Yes, this is a part of the readme: https://github.com/CleverTap/apns-http2/blob/master/README.md
Indeed, I have to learn to read "readme" files from top to bottom, but not just look at the code samples :) Interesting though that in my case exception was indicating the same issue as described by person who initiated this ticket:
...
Caused by: java.io.EOFException: \n not found: size=176
...
I believe the person has felt into the same trap as me.
We tried it with builder pattern you had provided, also we tried to use directly the constructor itself and then
client
private fromSyncOkHttpApnsClient.java
. But both produced same results.We also had same exception when we tried to use OkHttp. Any kind of help will be much appreciated.