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
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.0.0/gems/eventmachine-1.2.7/tests/test_servers.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/eventmachine-1.2.7/tests/test_servers.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/tests/test_servers.rb
sensu-em-2.7.0-java tests/test_servers.rb
eventmachine-1.2.7-java tests/test_servers.rb
eventmachine-1.2.7-x64-mingw32 tests/test_servers.rb
eventmachine-1.2.7-x86-mingw32 tests/test_servers.rb
eventmachine-1.2.7 tests/test_servers.rb
eventmachine-1.2.6-x64-mingw32 tests/test_servers.rb
eventmachine-1.2.6-x86-mingw32 tests/test_servers.rb
eventmachine-1.2.6-java tests/test_servers.rb
eventmachine-1.2.6 tests/test_servers.rb
eventmachine-1.2.5-x86-mingw32 tests/test_servers.rb
eventmachine-1.2.5-x64-mingw32 tests/test_servers.rb
eventmachine-1.2.5-java tests/test_servers.rb
eventmachine-1.2.5 tests/test_servers.rb
eventmachine-1.2.3-x64-mingw32 tests/test_servers.rb
eventmachine-1.2.3-x86-mingw32 tests/test_servers.rb
eventmachine-1.2.3-java tests/test_servers.rb
eventmachine-1.2.3 tests/test_servers.rb