Sha256: 9154ae7f81a7022401e7a469872aafceacc87770dabb268ae7bbf5d838f098b6
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
require 'udp_transceiver.rb' describe "UDP Transceiver" do it "should send a packet correctly" do bind="127.0.0.1" udp1=UdpTransceiver.new(bind,8889) udp2=UdpTransceiver.new("localhost",8898) c12=udp1.connect(udp2.me) c21=udp2.connect(udp1.me) str="MUH"*10 c21.send(str) sleep 0.5 c12.read.should == str udp1.close! udp2.close! end it "should work as a stream correctly" do bind="127.0.0.1" udp1=UdpTransceiver.new(bind,8889) udp2=UdpTransceiver.new("localhost",8898) c12=udp1.connect(udp2.me).stream c21=udp2.connect(udp1.me).stream str="MUH"*10000 c21.write(str) sleep 0.1 c12.read.should == str udp1.close! udp2.close! end it "should support several separate streams simultaneously" it "should ignore broken packets and afterwards it should continue" do bind="127.0.0.1" udp1=UdpTransceiver.new(bind,8889) udp2=UdpTransceiver.new("localhost",8898) c12=udp1.connect(udp2.me) udp2.close! sock=UDPSocket.open sock.send("BUGGYTEXT",0,bind,8889) c12.read.should be_nil udp2=UdpTransceiver.new("localhost",8898) c21=udp2.connect(udp1.me) c21.send("MUH") sleep 0.1 c12.read.should == "MUH" udp1.close! udp2.close! end it "should provide a receiving event-handler" do bind="127.0.0.1" udp1=UdpTransceiver.new(bind,8889) udp2=UdpTransceiver.new(bind,8898) c12=udp1.connect(udp2.me) res=nil udp2.receive{|from,packet| puts "__________________________" res=packet } str="MUH"*10 c12.send(str) sleep 0.5 res.should == str udp1.close! udp2.close! end it "should request a missing packet" it "should send acks every few messages" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appswarm-0.0.1 | apps/udp_network/spec/udp_transceiver_spec.rb |