I\'m using a third party Java library to interact with a REST API. The REST API can sometimes take a long time to respond, eventually resulting in a java.net.ConnectExcept
java.net.ConnectExcept
You could use a Timer and a TimerTask.