Class: Nonnative::CloseAllSocketPair

Inherits:
SocketPair show all
Defined in:
lib/nonnative/close_all_socket_pair.rb

Overview

Socket-pair variant used by the fault-injection proxy to simulate immediate connection failure.

When active, the proxy accepts a TCP connection and closes it immediately without forwarding any bytes to the upstream service.

This behavior is enabled by calling FaultInjectionProxy#close_all.

Instance Method Summary collapse

Methods inherited from SocketPair

#initialize

Constructor Details

This class inherits a constructor from Nonnative::SocketPair

Instance Method Details

#connect(local_socket) ⇒ void

This method returns an undefined value.

Closes the accepted socket immediately.

Parameters:

  • local_socket (TCPSocket)

    the accepted client socket



19
20
21
22
23
# File 'lib/nonnative/close_all_socket_pair.rb', line 19

def connect(local_socket)
  Nonnative.logger.info "closing socket '#{local_socket.inspect}' for 'close_all' pair"

  local_socket.close
end