String login = headers.getProperty(Stomp.Headers.Connect.LOGIN);
String passcode = headers.getProperty(Stomp.Headers.Connect.PASSCODE);
// skip to end of the packet
while (in.read() != 0) {}
final ConnectionInfo info = new ConnectionInfo();
final Short packet_id = new Short(PACKET_IDS.getNextShortSequence());
clientId = clientIds.generateId();
commandParser.setClientId(clientId);
info.setClientId(clientId);
info.setReceiptRequired(true);
info.setClientVersion(Integer.toString(getCurrentWireFormatVersion()));
info.setClosed(false);
info.setHostName("ttmp.fake.host.name");
info.setId(packet_id.shortValue());
info.setUserName(login);
info.setPassword(passcode);
info.setStartTime(System.currentTimeMillis());
info.setStarted(true);
AsyncHelper.tryUntilNotInterrupted(new AsyncHelper.Helper()
{
public void cycle() throws InterruptedException
{
pendingReadPackets.put(info);
}
});
addReceiptListener(new ReceiptListener()
{
public boolean onReceipt(Receipt receipt, DataOutput out)
{
if (receipt.getCorrelationId() != packet_id.shortValue()) return false;
final Short session_packet_id = new Short(PACKET_IDS.getNextShortSequence());
sessionId = clientIds.getNextShortSequence();
commandParser.setSessionId(sessionId);
final SessionInfo info = new SessionInfo();
info.setStartTime(System.currentTimeMillis());
info.setId(session_packet_id.shortValue());
info.setClientId(clientId);
info.setSessionId(sessionId);
info.setStarted(true);
info.setSessionMode(Session.AUTO_ACKNOWLEDGE);
info.setReceiptRequired(true);
AsyncHelper.tryUntilNotInterrupted(new AsyncHelper.Helper()
{
public void cycle() throws InterruptedException
{