WebDriverException: Unexpected end of stream on connection

recently I confront an exception after my test navigates to Google login page in web view. The error is:

org.openqa.selenium.WebDriverException: java.io.IOException: unexpected end of stream on Connection{, proxy=DIRECT hostAddress=/ cipherSuite=none protocol=http/1.1}
Build info: version: ‘3.12.0’, revision: ‘7c6e0b3’, time: ‘2018-05-08T14:04:26.12Z’
System info: host: ‘build-ios3.local’, ip: ‘fe80:0:0:0:ccf:2108:f18a:f464%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.5’, java.version: ‘1.8.0_161’
Driver info: driver.version: IOSDriver

My app also has Facebook login, but there it works as normal.
This exception happens also when screen is navigated back to some product details and rate the app pop is displayed.

NOTE: When I run the same test locally, it works with no Exception. But when I run it inside a job on Jenkins, I get this error.

Any idea what could be causing the problem? And how to solve this issue?

1 Like

If I had to guess, I’d say that the $JAVA_PATH for the Jenkins user does not include a .jar file that your local $JAVA_PATH does include. Maybe ALPN jar?

I am not sure how to check this. I search the whole folder ($JAVA_HOME), but I couldn’t find any alpn jar - not locally, not on jenkins.

I just downgraded from appium/java-client 6.0.0 back to 6.0.0-BETA5 and the trouble is gone. Maybe it’s the difference in jdk_1.8.0_66 (locally) and jdk_1.8.0_161 (jenkins). Need to check that out.

Java update does not work.

What I found out is that on Jenkins, this line of code crashes with the error above:


My current workaround is that I put this line of code to try-catch block and if exception hits, I call it once again and then it works. Does anyone have any idea what this could be about?

Could the app be in a transition? If the window was not fully rendered I could see a crash like this happening. I like the idea of using a try-catch block around this. You may want to add an explicit wait of 1 or 2 seconds to smooth out the automation.

No, webView loads completely. I did put threat to sleep for 7 seconds before that, but makes no difference. Also note, that with java-client6.0.0-BETA5 it works with no exception and this sounds like Java-client problem. But the funny thing is that on my local machine I’m using the same version of Appium, Java-client, Java and XCode and there is no problem. :confused: …I’m not sure what else could be different.

Is there any other solution?