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");