Skip to content

Commit 165ff59

Browse files
committed
fix: catch java.net.SocketTimeoutException
1 parent 73e1355 commit 165ff59

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/google/firebase/internal/ApacheHttp2Request.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.google.common.annotations.VisibleForTesting;
2222

2323
import java.io.IOException;
24+
import java.net.SocketTimeoutException;
2425
import java.util.concurrent.CancellationException;
2526
import java.util.concurrent.CompletableFuture;
2627
import java.util.concurrent.ExecutionException;
@@ -122,7 +123,8 @@ public void cancelled() {
122123
final SimpleHttpResponse response = responseFuture.get();
123124
return new ApacheHttp2Response(response);
124125
} catch (ExecutionException e) {
125-
if (e.getCause() instanceof ConnectTimeoutException) {
126+
if (e.getCause() instanceof ConnectTimeoutException
127+
|| e.getCause() instanceof SocketTimeoutException) {
126128
throw new IOException("Connection Timeout", e.getCause());
127129
} else if (e.getCause() instanceof HttpHostConnectException) {
128130
throw new IOException("Connection exception in request", e.getCause());

0 commit comments

Comments
 (0)