1 require 'romp'
 2 
 3 class Bar
 4     attr_reader :i
 5     
 6     def initialize(i, romp)
 7         @i = i
 8         @romp = romp
 9     end
10     
11     def release()
12         @romp.delete_reference(self)
13     end
14 end
15 
16 class Foo < Bar
17     # Initialize @i to 0
18     def initialize(romp)
19         super(0, romp)
20         @romp = romp
21     end
22 
23     # Set @i
24     def foo(i)
25         @i = i
26     end
27 
28     # Return a reference to a new Bar object with Bar.i = @i + 1
29     def bar()
30         b = Bar.new(@i + 1, @romp)
31         obj = @romp.create_reference(b)
32         return obj
33     end
34 
35     # Test iteration
36     def each()
37         yield 1
38         yield 2
39         yield 3
40     end
41 
42     def throw_exception2()
43         raise RuntimeError
44     end
45 
46     # Test exception
47     def throw_exception()
48         throw_exception2()
49     end
50 end
51 
52 # server = ROMP::Server.new('tcpromp://localhost:4242', nil, true)
53 # server = ROMP::Server.new('udpromp://localhost:4242', nil, true)
54 server = ROMP::Server.new('unixromp:///tmp/foo', nil, true)
55 f = Foo.new(server)
56 server.bind(f, "foo")
57 server.thread.join