Sha256: b7f5bb02d3269f2a083f156d4912945b80c49badb6e68b109699e50e4fb3f05f

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

module Stomper
  module Sockets
    class SSL < DelegateClass(OpenSSL::SSL::SSLSocket)
      include FrameReader
      include FrameWriter

      def initialize(host, port, *args)
        @context = OpenSSL::SSL::SSLContext.new
        @context.verify_mode = OpenSSL::SSL::VERIFY_NONE

        tcp_sock = TCPSocket.new(host, port)
        @socket = OpenSSL::SSL::SSLSocket.new(tcp_sock, @context)
        @socket.sync_close = true
        @socket.connect
        super(@socket)
      end

      def ready?
        @socket.io.ready?
      end
      
      def shutdown(mode=2)
        @socket.io.shutdown(mode)
      end
    end

    class TCP < DelegateClass(TCPSocket)
      include FrameReader
      include FrameWriter

      def initialize(host, port, *args)
        @socket = TCPSocket.new(host, port)
        super(@socket)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stomper-1.0.0 lib/stomper/sockets.rb