Cross posting the answer by PG from Stack over-flow thread for visibility to the community members facing the same issue. Below is the response posted by the product team.
"The SDK does have some basic retry logic that will execute on its own whenever you lose connection. It uses an exponential backoff algorithm to decide how frequently to try to reconnect and, by default, will try for up to 4 minutes. In general, the default behavior isn't enough to stay "always connected". The first problem is that some disconnections last longer than 4 minutes. If the 4 minutes pass and the client fails to reconnect on its own, it will execute the connection status callback with status DISCONNECTED and stop retrying.
For simpler cases you can alter the 4 minute timeout by calling
deviceClient.setOperationTimeout(<new timeout value>);
Beyond that, we recommend having some retry logic sitting on top of the device client as well to catch for unusual cases. We maintain some sample code of what we recommend in this regard. That sample code is pretty complex, and may be overkill for some scenarios, though. If your code is pretty simple, then you are fine just wrapping your sendEventAsync call in a while loop like"
DeviceClient deviceClient = new DeviceClient(...);
deviceClient.setOperationTimeout(Long.MAX_VALUE)
deviceClient.open(true);
bool messageSent = false;
while (!messageSent)
{
try
{
deviceClient.sendEventAsync(...);
messageSent = true;
}
catch (IllegalStateException e)
{
// device needs to reconnect
deviceClient.open(true);
}
}