Switch to using one socket

This commit is contained in:
Jordan Sissel 2012-12-31 15:46:39 -08:00
parent b63cde62c0
commit f3907ede13

View file

@ -76,7 +76,7 @@ describe "inputs/tcp" do
output = Shiftback.new do |event| output = Shiftback.new do |event|
sequence += 1 sequence += 1
begin begin
insist { event.message } == "Hello ü Û" insist { event.message } == "Hello ü Û\n"
insist { event.message.encoding } == Encoding.find("UTF-8") insist { event.message.encoding } == Encoding.find("UTF-8")
rescue Exception => failure rescue Exception => failure
# Get out of the threads nets # Get out of the threads nets
@ -93,13 +93,11 @@ describe "inputs/tcp" do
tcp.run(output) tcp.run(output)
end end
#Send events from clients sockets #Send events from clients sockets
client_socket = TCPSocket.new("0.0.0.0", port)
event_count.times do |value| event_count.times do |value|
client_socket = TCPSocket.new("0.0.0.0", port) client_socket.write "Hello ü Û\n"
client_socket.write "Hello ü Û"
client_socket.close
# micro sleep to ensure sequencing
sleep(0.1)
end end
client_socket.close
#wait for input termination #wait for input termination
puts "Waiting for tcp input thread to finish" puts "Waiting for tcp input thread to finish"
thread.join thread.join