I’m thinking of playing around with raw bytes SSLSocket sends into underlying TCPSocket. In order to do that, I decided to patch TCPSocket methods in the way shown below. However, the overridden methods were not invoked.
class TCPSocket
def write(*args)
p "write"
super *args
end
def read(*args)
p "read"
super *args
end
end
Tcp_socket = TCPSocket.open '127.0.0.1', 443
ssl_context = OpenSSL::SSL::SSLContext.new
socket = OpenSSL::SSL::SSLSocket.new(Tcp_socket, ssl_context)
socket.connect