Package org.mockserver.exception
Class ExceptionHandling
java.lang.Object
org.mockserver.exception.ExceptionHandling
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseOnFlush(io.netty.channel.Channel ch) Closes the specified channel after all queued write requests are flushed.static booleanconnectionClosedException(Throwable throwable) returns true is the exception was caused by the connection being closedstatic booleanconnectionException(Throwable throwable) static <T> ThandleThrowable(Callable<T> callable) static <T> ThandleThrowable(CompletableFuture<T> future, long timeout, TimeUnit unit) static booleanisSslOrDecoderFault(Throwable throwable) returns true if the exception is a genuine SSL or decoder fault, i.e. the SSL/decoder subset thatconnectionClosedException(Throwable)returns false for at lines 123-124 (anSSLExceptioncause, aDecoderException, or aNotSslRecordException).static StringsniDescription(io.netty.channel.Channel... channels) Returns a log suffix identifying the SNI hostname of the failed connection, formatted as" (SNI: <host>)", using the first non-null SNI hostname found across the given channels, or""when none of the channels carried an SNI hostname.static booleansslHandshakeException(Throwable throwable) static void
-
Constructor Details
-
ExceptionHandling
public ExceptionHandling()
-
-
Method Details
-
handleThrowable
-
handleThrowable
-
swallowThrowable
-
sniDescription
Returns a log suffix identifying the SNI hostname of the failed connection, formatted as" (SNI: <host>)", using the first non-null SNI hostname found across the given channels, or""when none of the channels carried an SNI hostname. Several channels can be passed (e.g. relay handlers hold both an upstream and a downstream channel) so the SNI is found whichever channel recorded it. Null-safe — anullarray, ornullelements within it, are skipped.- Parameters:
channels- the channels to search for a recorded SNI hostname- Returns:
" (SNI: <host>)"for the first hostname found, otherwise""
-
closeOnFlush
public static void closeOnFlush(io.netty.channel.Channel ch) Closes the specified channel after all queued write requests are flushed. -
connectionClosedException
returns true is the exception was caused by the connection being closed -
isSslOrDecoderFault
returns true if the exception is a genuine SSL or decoder fault, i.e. the SSL/decoder subset thatconnectionClosedException(Throwable)returns false for at lines 123-124 (anSSLExceptioncause, aDecoderException, or aNotSslRecordException). Note thatconnectionClosedExceptionalso returns false for benign connection resets via its message-regex and stack-trace inspection; those are NOT matched here. Callers can use this to surface real SSL/decoder faults at WARN rather than dropping them silently alongside benign connection closes. -
sslHandshakeException
-
connectionException
-