Skip to content

Intercept reads/writes to underlying TCPSocket #235

Description

@ertygiq

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions