Package org.mockserver.model
Class TcpChaosProfile
java.lang.Object
org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
org.mockserver.model.ObjectWithJsonToString
org.mockserver.model.TcpChaosProfile
Declarative TCP-layer fault/chaos injection profile, applied at the raw byte
level before HTTP decoding. Each fault type mirrors one of
Toxiproxy's named toxics:
- latency — delay all inbound data by
latencyMsmilliseconds - down — silently drop all inbound data (service appears down)
- bandwidth — throttle inbound data to
bandwidthBytesPerSec - slow_close — delay the TCP FIN by 2 seconds
- timeout — never send FIN; connection hangs on close
- reset_peer — send TCP RST and close immediately
- slicer — fragment inbound data into chunks of
slicerChunkSizebytes - limit_data — close the connection after
limitDataBytesbytes received
Profiles are registered in the TcpChaosRegistry
and applied by the TcpChaosHandler Netty handler. When multiple faults are
configured on the same profile, they are evaluated in priority order: down, resetPeer,
limitData, slicer, bandwidth, latency.
Follows the model field/withX/getter convention so it round-trips through
Jackson without a bespoke (de)serializer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetDown()booleanReturnstruewhen at least one fault is configured (non-null and meaningful).inthashCode()static TcpChaosProfilewithBandwidthBytesPerSec(Long bandwidthBytesPerSec) withLatencyMs(Long latencyMs) withLimitDataBytes(Long limitDataBytes) withResetPeer(Boolean resetPeer) withSlicerChunkSize(Integer slicerChunkSize) withSlowClose(Boolean slowClose) withTimeout(Boolean timeout) Methods inherited from class org.mockserver.model.ObjectWithJsonToString
toStringMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
Constructor Details
-
TcpChaosProfile
public TcpChaosProfile()
-
-
Method Details
-
tcpChaosProfile
-
getLatencyMs
-
withLatencyMs
-
getDown
-
withDown
-
getBandwidthBytesPerSec
-
withBandwidthBytesPerSec
-
getSlowClose
-
withSlowClose
-
getTimeout
-
withTimeout
-
getResetPeer
-
withResetPeer
-
getSlicerChunkSize
-
withSlicerChunkSize
-
getLimitDataBytes
-
withLimitDataBytes
-
hasAnyFault
public boolean hasAnyFault()Returnstruewhen at least one fault is configured (non-null and meaningful). -
equals
- Overrides:
equalsin classObjectWithReflectiveEqualsHashCodeToString
-
hashCode
public int hashCode()- Overrides:
hashCodein classObjectWithReflectiveEqualsHashCodeToString
-