Related questions check this answerthis answer as is related to the case you are encountering.
Testing connectTimeout you can refer to this answerthis answer of various ways of having an endpoint that prevents a socket connection from completing thus obtaining a timeout. Choosing a solution, you can create an integration test in spring-boot which validates your implementation. This can be similar to the next test used for testing the readTimeout, just that for this case the URL can be changed into one that prevents a socket connection.