spec/test_server.rb in instrumental_agent-0.3.0 vs spec/test_server.rb in instrumental_agent-0.4.0
- old
+ new
@@ -3,30 +3,35 @@
def initialize
@connect_count = 0
@connections = []
@commands = []
+ @host = 'localhost'
listen
end
def listen
@port ||= 10001
@server = TCPServer.new(port)
Thread.new do
begin
# puts "listening"
- socket = @server.accept
- @connect_count += 1
- @connections << socket
- # puts "connection received"
loop do
- command = socket.gets.strip
- # puts "got: #{command}"
- commands << command
+ socket = @server.accept
+ Thread.new do
+ @connect_count += 1
+ @connections << socket
+ # puts "connection received"
+ loop do
+ command = socket.gets.strip
+ # puts "got: #{command}"
+ commands << command
+ end
+ end
end
rescue Exception => err
unless @stopping
- # puts "EXCEPTION:", err unless @stopping
+ puts "EXCEPTION:", err unless @stopping
retry
end
end
end
# puts "server up"