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
eventmachine-1.2.2-java tests/test_servers.rb
eventmachine-1.2.2 tests/test_servers.rb
eventmachine-1.2.2-x86-mingw32 tests/test_servers.rb
eventmachine-1.2.2-x64-mingw32 tests/test_servers.rb
arcabouco-0.2.13 vendor/bundle/gems/eventmachine-1.2.0.1/tests/test_servers.rb
arcabouco-0.2.13 vendor/bundle/gems/eventmachine-1.2.1/tests/test_servers.rb
eventmachine-1.2.1-java tests/test_servers.rb
eventmachine-1.2.1-x64-mingw32 tests/test_servers.rb
eventmachine-1.2.1-x86-mingw32 tests/test_servers.rb
eventmachine-1.2.1 tests/test_servers.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/eventmachine-1.2.0.1/tests/test_servers.rb
sensu-em-2.6.0-java tests/test_servers.rb
eventmachine-1.2.0.1-java tests/test_servers.rb
eventmachine-1.2.0.1-x86-mingw32 tests/test_servers.rb
eventmachine-1.2.0.1-x64-mingw32 tests/test_servers.rb
eventmachine-1.2.0.1 tests/test_servers.rb
eventmachine-1.2.0 tests/test_servers.rb
eventmachine-1.2.0-x86-mingw32 tests/test_servers.rb
eventmachine-1.2.0-x64-mingw32 tests/test_servers.rb
eventmachine-1.2.0.dev.2 tests/test_servers.rb