httpClient.start();
final Map<String, Object> options = new HashMap<String, Object>();
final ClientTransport transport = LongPollingTransport.create(options, httpClient);
final BayeuxClient client = new BayeuxClient("http://localhost:8090/ajax/cometd", transport);
client.handshake();
final boolean handshaken = client.waitFor(1000, BayeuxClient.State.CONNECTED);
if (!handshaken)
{
System.err.println("Handshake failed");
System.exit(-1);
}
client.getChannel("/financial/news").subscribe(new ClientSessionChannel.MessageListener()
{
public void onMessage(final ClientSessionChannel channel, final Message message)
{
System.out.println(" Received on " + AJAX_CHANNEL + ": " + message);
}