google / google/j2objc

java.net.SocketTimeoutException When switching from https to http

Open
#617 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6k
Forks
999
Avg merge
19h 20m
Merged PRs (30d)
14

Description

I use the following Java code to test a redirect from http to https and the other way round.

https://gist.github.com/confile/c52bad81212011b9efd3

Setup1:
My server redirects http requests to https.

The is works fine with the code above.

Setup2:
My server redirects https to http.

This leads to the following error:

```
java.net.SocketTimeoutException: http://www.test.de/myapi/start?cookie=&
at 0x0000000113399a39 java.net.SocketTimeoutException.() + 17
at 0x000000011332a1af com.google.j2objc.net.IosHttpURLConnection.makeSynchronousRequest() + 2443
at 0x000000011332980f com.google.j2objc.net.IosHttpURLConnection.getResponseCode() + 36
at 0x000000011324a06c test.core.network.ConnectionImpl.request() + 1132
at 0x00000001132fe600 test.core.rest.SessionStartRestService.saveOrCreate() + 624
at 0x00000001132173ea test.core.bootstrap.AppStarter.callServerSessionStartAction() + 250
at 0x0000000113216d73 test.core.bootstrap.AppStarter.bootstrap() + 6515
at 0x000000011321533a test.core.bootstrap.AppStarter.start() + 138
at 0x0000000111ec6475 UIApplication._handleDelegateCallbacks() + 234
at 0x0000000111ec6fbc UIApplication._callInitializationDelegatesForMainScene:transitionContext:() + 2463
at 0x0000000111ec9d2c UIApplication._run() + 1350
at 0x0000000111ec8bf2 UIApplication.workspaceDidEndTransaction:() + 179
at 0x00000001175e62a3 FBSSerialQueue.performAsync:() + 16
at 0x0000000111ec8669 UIApplication._run() + 413
```

When I reset my simulator with `Reset Content and Settings..` from the menu then setup2 works without problems. When I switch to Setup1 it also works but when I switch to Setup2 I get the same error again.

It seems to me that there is some kind of connection caching going on here. Is there any way to reset this without reseting the device?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.