Sha256: 3ae76fccb587b82ea9d386770eca48a68c9e520be517a033a855110ad7ae1de9

Contents?: true

Size: 761 Bytes

Versions: 9

Compression:

Stored size: 761 Bytes

Contents

#!/usr/bin/ruby

$:.unshift "#{File.dirname(__FILE__)}/../../lib"

require 'test/unit'
require 'xmpp4r'

class DisconnectExceptionTest < Test::Unit::TestCase
  class Listener
    def receive(element)
    end
  end
  
  def test_streamparser
    rd, wr = IO.pipe
    listener = Listener.new
    exception_raised = nil
    
    Thread.new do
      begin
        parser = Jabber::StreamParser.new(rd, listener)
        parser.parse
      rescue => e
        exception_raised = e
      end
    end
    
    wr.write("<hi/>")
    wr.close
    sleep(0.1)
    
    assert exception_raised
    assert exception_raised.is_a?(Jabber::ServerDisconnected), "Expected a Jabber::ServerDisconnected but got #{exception_raised}"
    # puts exception_raised.inspect
  end
  
end

Version data entries

9 entries across 9 versions & 4 rubygems

Version Path
brontes3d-xmpp4r-0.4 test/reliable/tc_disconnect_exception.rb
ln-xmpp4r-0.5 test/reliable/tc_disconnect_exception.rb
xmpp4r-0.5.6 test/reliable/tc_disconnect_exception.rb
xmpp4r-0.5.5 test/reliable/tc_disconnect_exception.rb
mad-p-xmpp4r-0.6.3 test/reliable/tc_disconnect_exception.rb
mad-p-xmpp4r-0.6.2 test/reliable/tc_disconnect_exception.rb
mad-p-xmpp4r-0.6.1 test/reliable/tc_disconnect_exception.rb
mad-p-xmpp4r-0.6.0 test/reliable/tc_disconnect_exception.rb
xmpp4r-0.5 test/reliable/tc_disconnect_exception.rb