Sha256: 3b9fb35c8a8a8ab19fc9b20e05ad5a18680b1972a0fc18bc1628052f886aec0e

Contents?: true

Size: 698 Bytes

Versions: 4

Compression:

Stored size: 698 Bytes

Contents

require_relative '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

4 entries across 4 versions & 2 rubygems

Version Path
eventmachine-mkroman-1.3.0.dev.1 tests/test_object_protocol.rb
wj_eventmachine-1.3.2 tests/test_object_protocol.rb
wj_eventmachine-1.3.1 tests/test_object_protocol.rb
wj_eventmachine-1.3.0.dev.1 tests/test_object_protocol.rb