<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -162,6 +162,7 @@ module OSC
   class Bundle
     attr_accessor :timetag 
     attr_accessor :args
+    attr_accessor :source
     alias :timestamp :timetag
     alias :messages :args
     alias :contents :args
@@ -193,6 +194,11 @@ module OSC
     def_delegators(:@args, *de)
 
     undef_method :zip
+    
+    def encode
+      Packet.encode(self)
+    end
+    
   end
 
   # Unit of transmission.  Really needs revamping</diff>
      <filename>lib/osc.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
+$:.unshift(File.dirname(__FILE__) + &quot;/../lib/&quot;)
 require 'osc'
 require 'time'
 require 'test/unit'
@@ -19,7 +20,7 @@ class TC_OSC &lt; Test::Unit::TestCase
     assert_equal 'f', Packet.tag(f)
     assert_equal 's', Packet.tag(s)
     assert_equal s+&quot;\000&quot;, Packet.encode(s)
-    b = Blob.new(File.read($0))
+    b = Blob.new(&quot;foobardoobar\0\0x200&quot;)
     assert_equal 'b', Packet.tag(b)
     assert_equal b.size+4 + (b.size+4)%4, Packet.encode(b).size
   end
@@ -63,8 +64,15 @@ class TC_OSC &lt; Test::Unit::TestCase
     assert_instance_of Array, b2.to_a
     assert_instance_of Bundle, b2.to_a[0]
     assert_instance_of Message, b2.to_a[1]
+
+    bundle = Packet.decode(e)
+    assert_instance_of Bundle, bundle
+    
+
   end
 
+
+
   def test_packet
     m = Message.new '/foo','s','foo'
     b = Bundle.new nil,m
@@ -79,24 +87,37 @@ class TC_OSC &lt; Test::Unit::TestCase
     assert_equal b.args.size,b2.args.size
   end
 
+  class TestServer
+    include OSC::Transport
+    include OSC::Server
+    def test_request(p)
+      send p
+    end
+    
+    def send_raw(msg, *args)
+      dispatch msg
+    end
+    
+  end
+
   def test_server
-    s = UDPServer.new
-    s.bind('localhost','12345')
+    s = TestServer.new
     s.add_method('/foo/bar',nil) { |msg| 
       assert_equal 'si',msg.typetag
       assert_equal 'Hello, World!',msg[0]
       assert_equal 42,msg[1]
-    }
-    t = Thread.new { s.serve } 
-
-    c = UDPSocket.new
-    c.connect('localhost','12345')
-    c.send(Message.new(&quot;/foo/bar&quot;,'si','Hello, World!',42),0)
+    }    
+    s.test_request Message.new(&quot;/foo/bar&quot;,'si','Hello, World!',42)
+  end
 
-    Thread.new { 
-      sleep 1
-      Thread.kill t
-    }
+  def test_server_with_bundle
+    s = TestServer.new
+    s.add_method('/foo/bar',nil) { |msg| 
+      assert_equal 'si',msg.typetag
+      assert_equal 'Hello, World!',msg[0]
+      assert_equal 42,msg[1]
+    }    
+    s.test_request Bundle.new(nil, Message.new(&quot;/foo/bar&quot;,'si','Hello, World!',42), Message.new(&quot;/foo/bar&quot;,'si','Hello, World!',42), Message.new(&quot;/foo/bar&quot;,'si','Hello, World!',42))
   end
 
   def test_pattern</diff>
      <filename>test/test_osc.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5d99c287e20c834af5e4980d9f4158d8df9062c2</id>
    </parent>
  </parents>
  <author>
    <name>Jan Krutisch</name>
    <email>jan@krutisch.de</email>
  </author>
  <url>http://github.com/halfbyte/rosc/commit/181928237f9cd5066eb28676900afeee6f416526</url>
  <id>181928237f9cd5066eb28676900afeee6f416526</id>
  <committed-date>2008-05-18T15:03:44-07:00</committed-date>
  <authored-date>2008-05-18T15:03:44-07:00</authored-date>
  <message>Fixing Tests and fixing bundle decoding

* Bundle Decoding works after adding :source as an attribute
* Bundle has encode() now
* The server tests are now done with a TestServer that bypasses networking, since opening threads in a unit test is no good
* A new test for bundle decoding</message>
  <tree>8a12edad73629dc80a7fbf33790222c6d5f9e5a2</tree>
  <committer>
    <name>Jan Krutisch</name>
    <email>jan@krutisch.de</email>
  </committer>
</commit>
