Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasync not working for Android API Level < 25 #143

Open
phillippbertram opened this issue Jan 12, 2017 · 3 comments
Open

wasync not working for Android API Level < 25 #143

phillippbertram opened this issue Jan 12, 2017 · 3 comments

Comments

@phillippbertram
Copy link

phillippbertram commented Jan 12, 2017

Hi there!

I am using wasync 2.3.1 in my current Project and everything worked fine till I tried my app on an API-Level < 25.
My app crashes when creating the socket from the client because of an java.lang.VerifyError for JDKAsyncHttpProvider.

Example Code:

AtmosphereClient client = ClientFactory.getDefault().newClient(AtmosphereClient.class);

RequestBuilder request = client.newRequestBuilder()
        .method(Request.METHOD.GET)
        .uri("" + "/suspend")
        .enableProtocol(true)
        .transport(Request.TRANSPORT.LONG_POLLING);


Socket socket = client.create(); // <--- here it crashes!!!

try {
    socket.on(new Function<Reader>() {
        @Override
        public void on(Reader r) {
            // Read the response
            Log.d("WebSocket", "response");
        }
    }).on(new Function<IOException>() {

        @Override
        public void on(IOException ioe) {
            // Some IOException occurred
            Log.d("WebSocket", "IOException");
        }

    }).open(request.build()).fire("echo").fire("bong");
} catch (IOException e) {
    e.printStackTrace();
}

I also tried many other Client implementations, but always with the same result.

I get following stacktrace:

java.lang.VerifyError: com/ning/http/client/providers/jdk/JDKAsyncHttpProvider
                       at com.ning.http.client.AsyncHttpClient.loadDefaultProvider(AsyncHttpClient.java:591)
                       at com.ning.http.client.AsyncHttpClient.<init>(AsyncHttpClient.java:187)
                       at org.atmosphere.wasync.impl.ClientUtil.createDefaultAsyncHttpClient(ClientUtil.java:51)
                       at org.atmosphere.wasync.impl.ClientUtil.createDefaultAsyncHttpClient(ClientUtil.java:38)
                       at org.atmosphere.wasync.impl.ClientUtil.create(ClientUtil.java:76)
                       at org.atmosphere.wasync.impl.AtmosphereClient.create(AtmosphereClient.java:41)
                       at ...

After unsuccessfully reading several threads and wasting much time, I just downgraded wasync to 2.1.2 and the error was gone but other issues occured.

Furthermore I tried the official android-chat with the same result.

I also unsuccessfully tested this with other AHC Provider (Grizzly, Netty).

Here is a table with all the results for each wAsync Version and Android API Level I have tried:

wAsync Version Android API Level Result
2.1.3 25 yes
2.1.3 23 No virtual methos setEndpointIdentificationAlgorithm(Ljava/lang/String;) in class Ljavax/net/ssl/SSLParameters; ...
2.1.3 19 java.lang.VerifyError: com/ning/http/client/providers/jdk/JDKAsyncHttpProvider
2.1.3 17 java.lang.VerifyError: com/ning/http/client/providers/jdk/JDKAsyncHttpProvider
2.1.2 25 yes
2.1.2 19 NoSuchMethodError javax.net.ssl.SSLParameters.sendEndpointIdentificationAlgorithm
2.1.2 17 java.lang.NullPointerException: ssl == null / java.lang.ExceptionInInitializerError
2.1.0 19 NoSuchMethodError javax.net.ssl.SSLParameters.sendEndpointIdentificationAlgorithm
1.4.3 25 java.lang.NullPointerException: ssl == null
1.4.3 23 java.lang.NullPointerException: ssl == null
1.4.3 19 java.io.IOException: Remotely Closed
1.4.3 17 java.io.IOException: Remotely Closed
@phillippbertram phillippbertram changed the title java.lang.VerifyError for Android API Level < 21 with wasync Version 2.1.3 wasync not working for Android API Level < 25 Jan 13, 2017
@erobic
Copy link

erobic commented Mar 10, 2017

I am facing exactly same problems. Have you guys found out the solution?

@phillippbertram
Copy link
Author

Unfortunately no 😢

We just used Version 1.4.3 because it was the most stable one for our API Level range.
We could handle the java.io.IOException: Remotely Closed Exception, because it was just thrown because of an self signed certificate on server side.

I am still waiting for any feedback 🙄

@ricardojlrufino
Copy link
Contributor

I think the supported minimum should be API 19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants