jruby-openssl
jruby-openssl copied to clipboard
Intercept reads/writes to underlying TCPSocket
Is there a way to intercept reads and writes SSLSocket does into underlying TCPSocket? I tried the following way, but 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', 80
ssl_context = OpenSSL::SSL::SSLContext.new
socket = OpenSSL::SSL::SSLSocket.new(Tcp_socket, ssl_context)
socket.connect