Class: Nonnative::InvalidDataSocketPair
- Inherits:
-
SocketPair
- Object
- SocketPair
- Nonnative::InvalidDataSocketPair
- Defined in:
- lib/nonnative/invalid_data_socket_pair.rb
Overview
Socket-pair variant used by the fault-injection proxy to simulate corrupted/incoherent traffic.
When active, data written to the upstream socket is corrupted by shuffling the characters in the payload before forwarding.
This behavior is enabled by calling FaultInjectionProxy#invalid_data.
Instance Method Summary collapse
-
#write(socket, data) ⇒ Integer
Writes corrupted data to the socket by shuffling characters.
Methods inherited from SocketPair
Constructor Details
This class inherits a constructor from Nonnative::SocketPair
Instance Method Details
#write(socket, data) ⇒ Integer
Writes corrupted data to the socket by shuffling characters.
20 21 22 23 24 25 26 |
# File 'lib/nonnative/invalid_data_socket_pair.rb', line 20 def write(socket, data) Nonnative.logger.info "shuffling socket data '#{socket.inspect}' for 'invalid_data' pair" data = data.chars.shuffle.join super end |