Sha256: 2bb2bd052f7b32997436ff4a8be21150405ca611fbfbe48a6985e215e96c63d2
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
require 'minitest/autorun' require 'dnssd' class TestDNSSDReplyResolve < MiniTest::Unit::TestCase def setup @port = Socket.getservbyname 'blackjack' @interface = DNSSD::InterfaceAny end def test_connect_tcp fullname = "blackjack\\032no\\032port._blackjack._tcp.local." reply = DNSSD::Reply::Resolve.new nil, 0, @interface, fullname, 'localhost', @port, nil server = TCPServer.new nil, @port socket = reply.connect assert_instance_of TCPSocket, socket assert_equal @port, socket.peeraddr[1] assert_equal 'localhost', socket.peeraddr[2] ensure socket.close if socket server.close if server end def test_connect_udp fullname = "blackjack\\032no\\032port._blackjack._udp.local." reply = DNSSD::Reply::Resolve.new nil, 0, @interface, fullname, 'localhost', @port, nil server = UDPSocket.new server.bind 'localhost', @port socket = reply.connect assert_instance_of UDPSocket, socket assert_equal @port, socket.peeraddr[1] assert_equal 'localhost', socket.peeraddr[2] ensure socket.close if socket server.close if server end end
Version data entries
4 entries across 4 versions & 2 rubygems