How AI is applied across API Evangelist and APIs.io. Read my AI disclosure →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

Unable to reproduce SocketReadTimeOut Error for okhttp3

calendar_today July 16, 2026 person Aditya Mehta domain spring-boot

We are trying to test ReadTimeOut exception by using useHttps() method of MockWebserver3, but unable to get this error. Please suggest if we can achieve this with useHttps() method, while upgrading springboot from 3.3.x to 3.5.x @Test void shouldThrowSocketTimeoutExceptionOnReadTimeout() { mockWebServer = new MockWebServer(); mockWebServer.useHttps(sslSocketFactory) // Arrange: enqueue a response that delays the body for 5 seconds mockWebServer.enqueue( new MockResponse().Builder .body(“This will be delayed”) .bodyDelay(5, TimeUnit.SECONDS).inTunnel().build() // Delay sending body ); OkHttpCli

open_in_new Read original post