68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/vendor/xmpp4r/test/bytestreams/tc_socks5bytestreams.rb', line 68
def test_pingpong
target = Bytestreams::SOCKS5BytestreamsTarget.new(@server, '1', '[email protected]/1', '[email protected]/2')
initiator = Bytestreams::SOCKS5BytestreamsInitiator.new(@client, '1', '[email protected]/1', '[email protected]/2')
initiator.add_streamhost(@@server)
Thread.new do
target.accept
while buf = target.read(256)
target.write(buf)
target.flush
end
target.close
end
initiator.open
10.times do
buf = create_buffer(8192)
initiator.write(buf)
initiator.flush
bufr = ''
begin
bufr += initiator.read(256)
end while bufr.size < buf.size
assert_equal(buf, bufr)
end
initiator.close
end
|