}
public void testStreamMessageEOF() throws Exception
{
Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "test");
AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
AMQHeadersExchange queue =
new AMQHeadersExchange(new AMQBindingURL(
ExchangeDefaults.HEADERS_EXCHANGE_CLASS + "://" + ExchangeDefaults.HEADERS_EXCHANGE_NAME
+ "/test/queue1?" + BindingURL.OPTION_ROUTING_KEY + "='F0000=1'"));
FieldTable ft = new FieldTable();
ft.setString("F1000", "1");
MessageConsumer consumer =
consumerSession.createConsumer(queue, AMQSession.DEFAULT_PREFETCH_LOW_MARK,
AMQSession.DEFAULT_PREFETCH_HIGH_MARK, false, false, (String) null, ft);
// force synch to ensure the consumer has resulted in a bound queue
// ((AMQSession) consumerSession).declareExchangeSynch(ExchangeDefaults.HEADERS_EXCHANGE_NAME, ExchangeDefaults.HEADERS_EXCHANGE_CLASS);
// This is the default now
Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "test");
AMQSession producerSession = (AMQSession) con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
// Need to start the "producer" connection in order to receive bounced messages
_logger.info("Starting producer connection");
con2.start();
MessageProducer mandatoryProducer = producerSession.createProducer(queue);
// Third test - should be routed
_logger.info("Sending isBound message");
StreamMessage msg = producerSession.createStreamMessage();
msg.setStringProperty("F1000", "1");
msg.writeByte((byte) 42);