The author of this library is here :-)
As mentioned earlier, if you do not rely on hard-to-reach functions implemented directly in the TCP protocol (keep-alives), you are unlikely to be able to detect failures without actually sending data over the connection.
The linked library encapsulates traditional Java sockets, adding easily customizable periodic connection checks and ACKing. (This will remain invisible to the programmer). As soon as a malfunction is detected, all entered observers will be notified. (Depending on your configuration, which may be close to real time).
The surface is that lib is fairly easy to use (and, at least in my own projects, it works quite reliably).
The disadvantage is that the application layer is not intended to test connectivity. Thus, it is basically that lib uses things in ways that they are probably not intended to.
Side Note: You mentioned that your customers are cellular. Although the linked library will run on android, you can take a look at Push Notification Services instead of fixing connection problems yourself. This can improve, for example, battery consumption.
source share