Sha256: 75b1d243431a58dd5a57cc130e1326be42ddeab96ed89b2b009b5648e5d081a0

Contents?: true

Size: 946 Bytes

Versions: 10

Compression:

Stored size: 946 Bytes

Contents

require 'em_test_helper'

class TestSSLMethods < Test::Unit::TestCase

  module ServerHandler
    def post_init
      start_tls
    end

    def ssl_handshake_completed
      $server_called_back = true
      $server_cert_value = get_peer_cert
    end
  end

  module ClientHandler
    def post_init
      start_tls
    end

    def ssl_handshake_completed
      $client_called_back = true
      $client_cert_value = get_peer_cert
      EM.stop_event_loop
    end
  end

  def test_ssl_methods
    omit_unless(EM.ssl?)
    omit_if(rbx?)
    $server_called_back, $client_called_back = false, false
    $server_cert_value, $client_cert_value = nil, nil

    EM.run {
      EM.start_server("127.0.0.1", 9999, ServerHandler)
      EM.connect("127.0.0.1", 9999, ClientHandler)
    }

    assert($server_called_back)
    assert($client_called_back)

    assert($server_cert_value.is_a?(NilClass))
    assert($client_cert_value.is_a?(String))
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
eventmachine-1.0.9.1 tests/test_ssl_methods.rb
eventmachine-1.0.9.1-java tests/test_ssl_methods.rb
eventmachine-1.0.9-java tests/test_ssl_methods.rb
eventmachine-1.0.9 tests/test_ssl_methods.rb
eventmachine-1.0.8 tests/test_ssl_methods.rb
eventmachine-1.0.8-java tests/test_ssl_methods.rb
eventmachine-1.0.7 tests/test_ssl_methods.rb
eventmachine-1.0.7-java tests/test_ssl_methods.rb
eventmachine-1.0.6-java tests/test_ssl_methods.rb
eventmachine-1.0.6 tests/test_ssl_methods.rb