Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Unit Test SocketException

Hi all,

 

We have a retry feature implemented in our HttpClient. Basically our APIs allow re-submitting the request automatically if the connection lost (reset, refused).

 

We intent to use Jetty to fake exceptions like SocketException or ConnectException to test the retry logic. We tried a custom handler to throw exceptions we want but at client side we’ve never got those exceptions. Is there any way to send the client those exception?

 

Below is the client code.

      try {

          response = HttpClient.post (url, parameters);

        return response;

      }

      catch (ConnectException connEx) {

                // retry logic

      }

      catch (SocketException socketEx) {

                // retry logic

      }

 

I really appreciate your ideas,

 

Thanks.


Back to the top