def receive_data data
@buf << data
unless @started
if @buf.size >= 8
if @buf.slice!(0,8) == "AMQP\001\001\b\000"
send Protocol::Connection::Start.new(
8,
0,
{
:information => 'Licensed under the Ruby license. See http://github.com/tmm1/amqp',
:copyright => 'Copyright (c) 2008-2009 Aman Gupta',
:platform => 'Ruby/EventMachine',
:version => '0.6.1',
:product => 'SquirrelMQ'
},
'PLAIN AMQPLAIN',
'en_US'
)
else
close_connection
return
end
@started = true
else
return
end
end
while frame = Frame.parse(@buf)
process_frame frame
end
end