In my application i am trying to handles Exceptions that can arise from consuming http web services , as i know so far there are 3 types of exceptions that can arise
Transport ExceptionProtocol ExceptionTimeout Exception
i am using HttpClient class in my android application ,
i don’t have to supply login credential as a part of my http request so i think the Protocol Exception is rarely to occur , i know its not the only reason that a protocol exception can occur but its the most commonly one ,
for the transport exception i read that HttpClient is a robust to handle transport exception so it defects transport exception and retrying requests ,
so now for the timeout exception ( connections time out and socket time out ) is retrying the request is the proper way to handle these exception ? or there is more robust solution ?
You should not get any timeoutexception if you don’t set the associated properties in your http request. They are set to 0 by default and that means there is no timeout.
But giving an appropriate timeout and handling the exception as you propose to do it seems to be the right way.
Maybe you should also consider adding some code to detect network state.