public class ConnectionOpen extends TestCase {
public void testCorrectProtocolHeader() throws IOException {
ConnectionFactory factory = new ConnectionFactory();
SocketFrameHandler fh = new SocketFrameHandler(factory.getSocketFactory().createSocket("localhost", AMQP.PROTOCOL.PORT));
fh.sendHeader();
AMQCommand command = new AMQCommand();
while (!command.handleFrame(fh.readFrame())) { }
Method m = command.getMethod();
// System.out.println(m.getClass());
assertTrue("First command must be Connection.start",
m instanceof AMQP.Connection.Start);
AMQP.Connection.Start start = (AMQP.Connection.Start) m;
assertTrue("Version in Connection.start is <= what we sent",