@@ -49,6 +49,7 @@ void main() {
4949 sslExceptionHandler,
5050 zipExceptionHandler,
5151 incompatibleJavaAndGradleVersionsHandler,
52+ remoteTerminatedHandshakeHandler,
5253 ])
5354 );
5455 });
@@ -88,6 +89,50 @@ at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)''';
8889 ProcessManager : () => processManager,
8990 });
9091
92+ testUsingContext ('retries if remote host terminated ssl handshake' , () async {
93+ const String errorMessage = r'''
94+ Exception in thread "main" javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
95+ at java.base/sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1696)
96+ at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1514)
97+ at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1416)
98+ at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:456)
99+ at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:427)
100+ at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:572)
101+ at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197)
102+ at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2783)
103+ at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2695)
104+ at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1854)
105+ at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
106+ at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
107+ at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
108+ at org.gradle.wrapper.Download.download(Download.java:44)
109+ at org.gradle.wrapper.Install$1.call(Install.java:61)
110+ at org.gradle.wrapper.Install$1.call(Install.java:48)
111+ at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
112+ at org.gradle.wrapper.Install.createDist(Install.java:48)
113+ at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
114+ at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
115+ Caused by: java.io.EOFException: SSL peer shut down incorrectly
116+ at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:483)
117+ at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
118+ at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
119+ at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
120+ at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)''' ;
121+
122+ expect (formatTestErrorMessage (errorMessage, remoteTerminatedHandshakeHandler), isTrue);
123+ expect (await remoteTerminatedHandshakeHandler.handler (
124+ line: '' ,
125+ multidexEnabled: true ,
126+ project: FakeFlutterProject (),
127+ usesAndroidX: true ,
128+ ), equals (GradleBuildStatus .retry));
129+
130+ expect (testLogger.errorText,
131+ contains (
132+ 'Gradle threw an error while downloading artifacts from the network.'
133+ )
134+ );
135+ });
91136 testUsingContext ('retries if gradle fails downloading with proxy error' , () async {
92137 const String errorMessage = r'''
93138Exception in thread "main" java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 400 Bad Request"
0 commit comments