poll.setURL("http://localhost:8080/amq?timeout=5000");
poll.setRequestHeader( "Cookie", jsessionid );
httpClient.send( poll );
// stomp client queues some messages
StompConnection connection = new StompConnection();
connection.open(stompUri.getHost(), stompUri.getPort());
connection.connect("user", "password");
HashMap<String, String> headers = new HashMap<String, String>();
headers.put( "amq-msg-type", "text" );
connection.send( "/queue/test", "message1", (String)null, headers );
connection.send( "/queue/test", "message2", (String)null, headers );
connection.send( "/queue/test", "message3", (String)null, headers );
connection.send( "/queue/test", "message4", (String)null, headers );
connection.send( "/queue/test", "message5", (String)null, headers );
String frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
connection.sendFrame(frame);
// Need to let the transport have enough time to dispatch the incoming messages from
// the socket before we break the connection.
TimeUnit.SECONDS.sleep(5);
connection.disconnect();
// wait for poll to finish
poll.waitForDone();
String response = poll.getResponseContent();