Sha256: 934c3bf2037f0f9c72d0ba374337f8710a44a8d1587f076639a7a31bcb5385f6
Contents?: true
Size: 999 Bytes
Versions: 4
Compression:
Stored size: 999 Bytes
Contents
require_relative 'em_test_helper' class TestSASL < Test::Unit::TestCase # SASL authentication is usually done with UNIX-domain sockets, but # we'll use TCP so this test will work on Windows. As far as the # protocol handlers are concerned, there's no difference. TestUser,TestPsw = "someone", "password" class SaslServer < EM::Connection include EM::Protocols::SASLauth def validate usr, psw, sys, realm usr == TestUser and psw == TestPsw end end class SaslClient < EM::Connection include EM::Protocols::SASLauthclient end def setup @port = next_port end def test_sasl resp = nil EM.run { EM.start_server( "127.0.0.1", @port, SaslServer ) c = EM.connect( "127.0.0.1", @port, SaslClient ) d = c.validate?( TestUser, TestPsw ) d.timeout 1 d.callback { resp = true EM.stop } d.errback { resp = false EM.stop } } assert_equal( true, resp ) end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
eventmachine-mkroman-1.3.0.dev.1 | tests/test_sasl.rb |
wj_eventmachine-1.3.2 | tests/test_sasl.rb |
wj_eventmachine-1.3.1 | tests/test_sasl.rb |
wj_eventmachine-1.3.0.dev.1 | tests/test_sasl.rb |