Sha256: 5b62968d2f1f86a737ac8aa6279bdb60822627f13f8fa70e16e9af05790ca68c

Contents?: true

Size: 671 Bytes

Versions: 140

Compression:

Stored size: 671 Bytes

Contents

require 'em_test_helper'
require 'socket'

class TestServers < Test::Unit::TestCase

  def setup
    @port = next_port
  end

  def server_alive?
    port_in_use?(@port)
  end

  def run_test_stop_server
    EM.run {
      sig = EM.start_server("127.0.0.1", @port)
      assert server_alive?, "Server didn't start"
      EM.stop_server sig
      # Give the server some time to shutdown.
      EM.add_timer(0.1) {
        assert !server_alive?, "Server didn't stop"
        EM.stop
      }
    }
  end

  def test_stop_server
    assert !server_alive?, "Port already in use"
    2.times { run_test_stop_server }
    assert !server_alive?, "Servers didn't stop"
  end

end

Version data entries

140 entries across 137 versions & 9 rubygems

Version Path
sonixlabs-eventmachine-java-1.0.0.rc.4-java tests/test_servers.rb
eventmachine-1.0.0-java tests/test_servers.rb
eventmachine-1.0.0-x86-mingw32 tests/test_servers.rb
eventmachine-1.0.0-x86-mswin32-60 tests/test_servers.rb
eventmachine-1.0.0 tests/test_servers.rb
eventmachine-le-1.1.3 tests/test_servers.rb
eventmachine-maglev--1.0.0.rc.4 tests/test_servers.rb
eventmachine-maglev--1.0.0.beta.4 tests/test_servers.rb
eventmachine-le-1.1.2 tests/test_servers.rb
eventmachine-le-1.1.1 tests/test_servers.rb
eventmachine-1.0.0.rc.4-java tests/test_servers.rb
eventmachine-1.0.0.rc.4 tests/test_servers.rb
eventmachine-1.0.0.rc.4-x86-mswin32-60 tests/test_servers.rb
eventmachine-1.0.0.rc.4-x86-mingw32 tests/test_servers.rb
eventmachine-1.0.0.rc.3 tests/test_servers.rb
eventmachine-1.0.0.rc.3-x86-mswin32-60 tests/test_servers.rb
eventmachine-1.0.0.rc.3-x86-mingw32 tests/test_servers.rb
eventmachine-1.0.0.rc.3-java tests/test_servers.rb
eventmachine-1.0.0.rc.2-java tests/test_servers.rb
eventmachine-1.0.0.rc.2-x86-mswin32-60 tests/test_servers.rb