Forum Discussion

Kevin_Slade's avatar
Kevin_Slade
Contributor
15 years ago

How can I test for a Connection refused error

I have a test case where the expected action is that the server should not be accessable and therefore a Connection refused return is expected.

The Java system reports an error as below:

Thu Jan 28 09:57:47 NZDT 2010:ERROR:Exception in request: java.net.ConnectException: Connection refused


Is there any thing I can do to trap this error or to allow the error to occur and still have the tests validate that nothing was returned, in response to the call.

Thanks

Kevin

3 Replies

  • Hello

    I have finally had a chance to get back to this. The problem with the suggestion is that because the connection is refused, an exception is thrown and no MessageExchange object is available to be queried.

    I have looked at trying a groovy script following the failing step, but because of the exception, there again is no MessageExchange object to be used.

    A second issue is that because of the exception, the script is shown to have failed, even though this is the correct expected result.

    Cheers Kevin
    • cinne's avatar
      cinne
      Occasional Contributor

      I'm currently facing the same problem and was not able to find a solution so far... after all these years have you figure out a way to solve this issue?