-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
segfault using sslsocketfactory.createSocket from test package #753
Comments
Which version of OkHttp? Which version of Android? There's a fix in 1.5.4 that disables ALPN, which is broken in Android 4.4. |
Sorry about the missing info. okhttp 1.5.4 and we originally saw this on the x86 android 4.4 emulator, but I tested it on a device 4.4 and it failed immediately there aswel. I haven't tested on other versions, but I can do that tomorrow when I'm back at work. |
Can you paste the segfault dump from logcat? Usually this is triggered by sharing an SSLContext between OkHttp and non-OkHttp. |
Sorry.. worst bugreport ever, I did copy that into my clipboard, but I wrote half of the bugreport before a meeting, and finished it and clicked submit when I came back. |
@andaag don't use the system default SSLSocketFactory with OkHttp. If you delete this line, you'll be all good:
|
@swankjesse Ok, so that's no longer required? We have that because you told me to add it ;) //edit, no you did not, you told us to add the other line. And I put the comment on the wrong line, no idea where that other one comes from. Thanks! |
Glad to hear it's fixed. |
Hi
We have a project where our espresso tests require the use of a socket (to trigger a "this newly registered user has verified their email account, and should be allowed to login").
The way this works is that the tests run:
SSLSocketFactory sslsocketfactory = okHttpClient.getSslSocketFactory(); clientSocket = sslsocketfactory.createSocket(HOST, PORT); in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); out = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
OkHttpClient in this case we get from our application (not application's tests). In our application we run this:
URL.setURLStreamHandlerFactory(okHttpClient); okHttpClient.setSslSocketFactory(HttpsURLConnection.getDefaultSSLSocketFactory());
I'm not entirely clear on how the ssl context works in relation between the app. A quick test shows the code works when being run in the app, but not when being run in the test. If I try to setUrlStreamHandlerFactory/setSslSocketFactory in the test context as well I'm told it's already set.
We've also tried using SSLSocketFactory.getDefault(), it also segfaults.
The text was updated successfully, but these errors were encountered: