MailSlurp uses 'Keep-Alive' connections for many endpoints to allow your code to wait for conditions.

SDK timeout settings

It is important to set a connection timeout on the client and its underlying http client implementations when using the MailSlurp SDKs.

For example, in Java pass an instance to the and set , and timeouts.

This will help to avoid errors that you may encounter with default timeout settings.

The same approach applies to other languages.

Test framework settings

Sometimes connection exceptions can occur in testing frameworks such as or . We recommend setting similar timeouts for your test framework. In Javascript this looks like:

Most MailSlurp operations take several seconds. Waiting for emails is different and can take up to 120 seconds depending on the number of emails you are waiting for and the load on MailSlurp servers. Most clients take timeout values in milliseconds.

Support for continuing exception

If your connection or 502 errors continue please contact support and provide code examples so we can debug the issue further.