Sha256: 02e7c96d84b1bd6d5e1f1b9e81e088807511eff34ea1adf7cf1b636931f7a0a9

Contents?: true

Size: 944 Bytes

Versions: 4

Compression:

Stored size: 944 Bytes

Contents

$:.unshift "../lib"
require 'eventmachine'
require 'test/unit'

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
    $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

4 entries across 4 versions & 2 rubygems

Version Path
eventmachine-eventmachine-0.12.6 tests/test_ssl_methods.rb
eventmachine-eventmachine-0.12.7 tests/test_ssl_methods.rb
eventmachine-0.12.6-java tests/test_ssl_methods.rb
eventmachine-0.12.6 tests/test_ssl_methods.rb