Apparently API 35 / Android 15 have changes that affect how local hostnames (like localhost) are resolved.
Just add InetAddress.getByName("127.0.0.1")
to bind to the loopback address explicitly, to 127.0.0.1
, which is a localhost
IP, like this
mockWebServer.start(InetAddress.getByName("127.0.0.1"), 8080);
After this tests have started to work correct