Sha256: 3036a34736c646dfb0ff8886fb6912dead82cee650b407fd7fd3af8155b77086

Contents?: true

Size: 689 Bytes

Versions: 140

Compression:

Stored size: 689 Bytes

Contents

require 'em_test_helper'

class TestObjectProtocol < Test::Unit::TestCase
  module Server
    include EM::P::ObjectProtocol
    def post_init
      send_object :hello=>'world'
    end
    def receive_object obj
      $server = obj
      EM.stop
    end
  end

  module Client
    include EM::P::ObjectProtocol
    def receive_object obj
      $client = obj
      send_object 'you_said'=>obj
    end
  end

  def setup
    @port = next_port
  end

  def test_send_receive
    EM.run{
      EM.start_server "127.0.0.1", @port, Server
      EM.connect "127.0.0.1", @port, Client
    }

    assert($client == {:hello=>'world'})
    assert($server == {'you_said'=>{:hello=>'world'}})
  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_object_protocol.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/tests/test_object_protocol.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/eventmachine-1.2.7/tests/test_object_protocol.rb
sensu-em-2.7.0-java tests/test_object_protocol.rb
eventmachine-1.2.7-java tests/test_object_protocol.rb
eventmachine-1.2.7-x64-mingw32 tests/test_object_protocol.rb
eventmachine-1.2.7-x86-mingw32 tests/test_object_protocol.rb
eventmachine-1.2.7 tests/test_object_protocol.rb
eventmachine-1.2.6-x64-mingw32 tests/test_object_protocol.rb
eventmachine-1.2.6-x86-mingw32 tests/test_object_protocol.rb
eventmachine-1.2.6-java tests/test_object_protocol.rb
eventmachine-1.2.6 tests/test_object_protocol.rb
eventmachine-1.2.5-x86-mingw32 tests/test_object_protocol.rb
eventmachine-1.2.5-x64-mingw32 tests/test_object_protocol.rb
eventmachine-1.2.5-java tests/test_object_protocol.rb
eventmachine-1.2.5 tests/test_object_protocol.rb
eventmachine-1.2.3-x64-mingw32 tests/test_object_protocol.rb
eventmachine-1.2.3-x86-mingw32 tests/test_object_protocol.rb
eventmachine-1.2.3-java tests/test_object_protocol.rb
eventmachine-1.2.3 tests/test_object_protocol.rb