Java Code Examples for java.nio.ByteBuffer.putInt()

The following are Jave code examples for showing how to use putInt() of the java.nio.ByteBuffer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: kafka-0.11.0.0-src-with-comment   File: ByteBufferLogInputStreamTest.java   View Source Code Vote up 6 votes
@Test(expected = CorruptRecordException.class)
public void iteratorRaisesOnTooSmallRecords() throws IOException {
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    MemoryRecordsBuilder builder = MemoryRecords.builder(buffer, CompressionType.NONE, TimestampType.CREATE_TIME, 0L);
    builder.append(15L, "a".getBytes(), "1".getBytes());
    builder.append(20L, "b".getBytes(), "2".getBytes());
    builder.close();

    int position = buffer.position();

    builder = MemoryRecords.builder(buffer, CompressionType.NONE, TimestampType.CREATE_TIME, 2L);
    builder.append(30L, "c".getBytes(), "3".getBytes());
    builder.append(40L, "d".getBytes(), "4".getBytes());
    builder.close();

    buffer.flip();
    buffer.putInt(position + DefaultRecordBatch.LENGTH_OFFSET, 9);

    ByteBufferLogInputStream logInputStream = new ByteBufferLogInputStream(buffer, Integer.MAX_VALUE);
    assertNotNull(logInputStream.nextBatch());
    logInputStream.nextBatch();
}
 
Example 2
Project: CrashCoin   File: Block.java   View Source Code Vote up 6 votes
/**
 * Set the header into a single byte array.
 *
 * @return a byte[] representing the header
 */
public byte[] headerToBytes()  {
    final ByteBuffer buffer = ByteBuffer.allocate(Parameters.BLOCK_HEADER_SIZE);
    // insert magic number (4 bytes)
    buffer.putInt(Parameters.MAGIC_NUMBER);
    // insert reference to previous block (32 bytes)
    buffer.put(previousBlock);
    // insert Merkle root
    buffer.put(merkleRoot); // buffer.put(getTransactionHash());
    // insert difficulty (4 bytes)
    buffer.putInt(difficulty);
    // No need to store the number of transactions in byte representation
    // insert nonce (4 bytes)
    buffer.putInt(nonce);
    return buffer.array();
}
 
Example 3
Project: AndResM   File: TypeChunk.java   View Source Code Vote up 6 votes
private int writeEntries(DataOutput payload, ByteBuffer offsets, boolean shrink)
    throws IOException {
  int entryOffset = 0;
  for (int i = 0; i < entryCount; ++i) {
    Entry entry = entries.get(i);
    if (entry == null) {
      offsets.putInt(Entry.NO_ENTRY);
    } else {
      byte[] encodedEntry = entry.toByteArray(shrink);
      payload.write(encodedEntry);
      offsets.putInt(entryOffset);
      entryOffset += encodedEntry.length;
    }
  }
  entryOffset = writePad(payload, entryOffset);
  return entryOffset;
}
 
Example 4
Project: twister2   File: MPIMultiMessageSerializer.java   View Source Code Vote up 5 votes
private boolean buildSubMessageHeader(MPIBuffer buffer, int length) {
    ByteBuffer byteBuffer = buffer.getByteBuffer();
    if (byteBuffer.remaining() < 4) {
      return false;
    }
//    LOG.info(String.format("%d adding sub-header pos: %d", executor, byteBuffer.position()));
    byteBuffer.putInt(length);
    return true;
  }
 
Example 5
Project: hadoop   File: DataChecksum.java   View Source Code Vote up 5 votes
/**
 * Calculate checksums for the given data.
 * 
 * The 'mark' of the ByteBuffer parameters may be modified by this function,
 * but the position is maintained.
 * 
 * @param data the DirectByteBuffer pointing to the data to checksum.
 * @param checksums the DirectByteBuffer into which checksums will be
 *                  stored. Enough space must be available in this
 *                  buffer to put the checksums.
 */
public void calculateChunkedSums(ByteBuffer data, ByteBuffer checksums) {
  if (type.size == 0) return;
  
  if (data.hasArray() && checksums.hasArray()) {
    calculateChunkedSums(data.array(), data.arrayOffset() + data.position(), data.remaining(),
        checksums.array(), checksums.arrayOffset() + checksums.position());
    return;
  }

  if (NativeCrc32.isAvailable()) {
    NativeCrc32.calculateChunkedSums(bytesPerChecksum, type.id,
        checksums, data);
    return;
  }
  
  data.mark();
  checksums.mark();
  try {
    byte[] buf = new byte[bytesPerChecksum];
    while (data.remaining() > 0) {
      int n = Math.min(data.remaining(), bytesPerChecksum);
      data.get(buf, 0, n);
      summer.reset();
      summer.update(buf, 0, n);
      checksums.putInt((int)summer.getValue());
    }
  } finally {
    data.reset();
    checksums.reset();
  }
}
 
Example 6
Project: rocketmq-rocketmq-all-4.1.0-incubating   File: ConsumeQueue.java   View Source Code Vote up 5 votes
private void fillPreBlank(final MappedFile mappedFile, final long untilWhere) {
    ByteBuffer byteBuffer = ByteBuffer.allocate(CQ_STORE_UNIT_SIZE);
    byteBuffer.putLong(0L);
    byteBuffer.putInt(Integer.MAX_VALUE);
    byteBuffer.putLong(0L);

    int until = (int) (untilWhere % this.mappedFileQueue.getMappedFileSize());
    for (int i = 0; i < until; i += CQ_STORE_UNIT_SIZE) {
        mappedFile.appendMessage(byteBuffer.array());
    }
}
 
Example 7
Project: ditb   File: TestFuzzyRowFilterEndToEnd.java   View Source Code Vote up 5 votes
private void runTest1(Table hTable) throws IOException {
  // [0, 2, ?, ?, ?, ?, 0, 0, 0, 1]

  byte[] mask = new byte[] { 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 };

  List<Pair<byte[], byte[]>> list = new ArrayList<Pair<byte[], byte[]>>();
  for (int i = 0; i < totalFuzzyKeys; i++) {
    byte[] fuzzyKey = new byte[10];
    ByteBuffer buf = ByteBuffer.wrap(fuzzyKey);
    buf.clear();
    buf.putShort((short) 2);
    for (int j = 0; j < 4; j++) {
      buf.put(fuzzyValue);
    }
    buf.putInt(i);

    Pair<byte[], byte[]> pair = new Pair<byte[], byte[]>(fuzzyKey, mask);
    list.add(pair);
  }

  int expectedSize = secondPartCardinality * totalFuzzyKeys * colQualifiersTotal;
  FuzzyRowFilter fuzzyRowFilter0 = new FuzzyRowFilter(list);
  // Filters are not stateless - we can't reuse them
  FuzzyRowFilter fuzzyRowFilter1 = new FuzzyRowFilter(list);

  // regular test
  runScanner(hTable, expectedSize, fuzzyRowFilter0);
  // optimized from block cache
  runScanner(hTable, expectedSize, fuzzyRowFilter1);

}
 
Example 8
Project: rocketmq-rocketmq-all-4.1.0-incubating   File: MessageClientIDSetter.java   View Source Code Vote up 5 votes
private static byte[] createUniqIDBuffer() {
    ByteBuffer buffer = ByteBuffer.allocate(4 + 2);
    long current = System.currentTimeMillis();
    if (current >= nextStartTime) {
        setStartTime(current);
    }
    buffer.position(0);
    buffer.putInt((int) (System.currentTimeMillis() - startTime));
    buffer.putShort((short) COUNTER.getAndIncrement());
    return buffer.array();
}
 
Example 9
Project: kafka-0.11.0.0-src-with-comment   File: SaslAuthenticatorTest.java   View Source Code Vote up 5 votes
/**
 * Tests that packets that are too big during Kafka SASL handshake request flow
 * or the actual SASL authentication flow result in authentication failure
 * and do not cause any failures in the server.
 */
@Test
public void testPacketSizeTooBig() throws Exception {
    SecurityProtocol securityProtocol = SecurityProtocol.SASL_PLAINTEXT;
    configureMechanisms("PLAIN", Arrays.asList("PLAIN"));
    server = createEchoServer(securityProtocol);

    // Send SASL packet with large size after valid handshake request
    String node1 = "invalid1";
    createClientConnection(SecurityProtocol.PLAINTEXT, node1);
    sendHandshakeRequestReceiveResponse(node1);
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    buffer.putInt(Integer.MAX_VALUE);
    buffer.put(new byte[buffer.capacity() - 4]);
    buffer.rewind();
    selector.send(new NetworkSend(node1, buffer));
    NetworkTestUtils.waitForChannelClose(selector, node1, ChannelState.READY);
    selector.close();

    // Test good connection still works
    createAndCheckClientConnection(securityProtocol, "good1");

    // Send packet with large size before handshake request
    String node2 = "invalid2";
    createClientConnection(SecurityProtocol.PLAINTEXT, node2);
    buffer.clear();
    buffer.putInt(Integer.MAX_VALUE);
    buffer.put(new byte[buffer.capacity() - 4]);
    buffer.rewind();
    selector.send(new NetworkSend(node2, buffer));
    NetworkTestUtils.waitForChannelClose(selector, node2, ChannelState.READY);
    selector.close();

    // Test good connection still works
    createAndCheckClientConnection(securityProtocol, "good2");
}
 
Example 10
Project: kafka-0.11.0.0-src-with-comment   File: DefaultRecordBatchTest.java   View Source Code Vote up 5 votes
private static DefaultRecordBatch recordsWithInvalidRecordCount(Byte magicValue, long timestamp,
                                          CompressionType codec, int invalidCount) {
    ByteBuffer buf = ByteBuffer.allocate(512);
    MemoryRecordsBuilder builder = MemoryRecords.builder(buf, magicValue, codec, TimestampType.CREATE_TIME, 0L);
    builder.appendWithOffset(0, timestamp, null, "hello".getBytes());
    builder.appendWithOffset(1, timestamp, null, "there".getBytes());
    builder.appendWithOffset(2, timestamp, null, "beautiful".getBytes());
    MemoryRecords records = builder.build();
    ByteBuffer buffer = records.buffer();
    buffer.position(0);
    buffer.putInt(RECORDS_COUNT_OFFSET, invalidCount);
    buffer.position(0);
    return new DefaultRecordBatch(buffer);
}
 
Example 11
Project: s-store   File: ConstraintFailureException.java   View Source Code Vote up 5 votes
@Override
protected void p_serializeToBuffer(ByteBuffer b) throws IOException {
    super.p_serializeToBuffer(b);
    b.putInt(type.getValue());
    FastSerializer.writeString(tableName, b);
    b.putInt(buffer.capacity());
    buffer.rewind();
    b.put(buffer);
}
 
Example 12
Project: FApkSigner   File: V2SchemeSigner.java   View Source Code Vote up 5 votes
private static byte[] generateApkSigningBlock(byte[] apkSignatureSchemeV2Block) {
    // FORMAT:
    // uint64:  size (excluding this field)
    // repeated ID-value pairs:
    //     uint64:           size (excluding this field)
    //     uint32:           ID
    //     (size - 4) bytes: value
    // uint64:  size (same as the one above)
    // uint128: magic

    int resultSize =
            8 // size
            + 8 + 4 + apkSignatureSchemeV2Block.length // v2Block as ID-value pair
            + 8 // size
            + 16 // magic
            ;
    ByteBuffer result = ByteBuffer.allocate(resultSize);
    result.order(ByteOrder.LITTLE_ENDIAN);
    long blockSizeFieldValue = resultSize - 8;
    result.putLong(blockSizeFieldValue);

    long pairSizeFieldValue = 4 + apkSignatureSchemeV2Block.length;
    result.putLong(pairSizeFieldValue);
    result.putInt(APK_SIGNATURE_SCHEME_V2_BLOCK_ID);
    result.put(apkSignatureSchemeV2Block);

    result.putLong(blockSizeFieldValue);
    result.put(APK_SIGNING_BLOCK_MAGIC);

    return result.array();
}
 
Example 13
Project: feeyo-redisproxy   File: MessageDecoder.java   View Source Code Vote up 5 votes
public static byte[] encode(Message messageExt, boolean needCompress) {
   
	int sysFlag = messageExt.getSysFlag();
    byte[] body = messageExt.getBody();
    if (needCompress && (sysFlag & COMPRESSED_FLAG) == COMPRESSED_FLAG) {
    	body = Util.compress(body, 5);
    }
    int bodyLength = body.length;
    int storeSize = messageExt.getStoreSize();
    
    ByteBuffer byteBuffer;
    if (storeSize > 0) {
        byteBuffer = ByteBuffer.allocate(storeSize);
    } else {
        storeSize = 4 // 1 TOTALSIZE
            + 4 // 2 MAGICCODE
            + 4 // 3 BODYCRC
            + 8 // 4 QUEUEID
            + 8 // 5 PHYSICALOFFSET
            + 4 // 6 SYSFLAG
            + 8 // 7 BORNTIMESTAMP
            + 8 // 8 STORETIMESTAMP
            + 4 + bodyLength // 9 BODY
            + 0;
        byteBuffer = ByteBuffer.allocate(storeSize);
    }
    
    byteBuffer.putInt(storeSize);					   		    // 1 TOTALSIZE
    byteBuffer.putInt(MESSAGE_MAGIC_CODE);		        		// 2 MAGICCODE
    byteBuffer.putInt( messageExt.getBodyCRC() );				// 3 BODYCRC
    byteBuffer.putLong( messageExt.getQueueId() );	 			// 4 QUEUEID
    byteBuffer.putLong( messageExt.getCommitLogOffset() );		// 5 PHYSICALOFFSET
    byteBuffer.putInt(sysFlag);									// 6 SYSFLAG
    byteBuffer.putLong( messageExt.getBornTimestamp() );		// 7 BORNTIMESTAMP
    byteBuffer.putLong( messageExt.getStoreTimestamp() );	    // 8 STORETIMESTAMP
    byteBuffer.putInt(bodyLength);								// 9 BODY
    byteBuffer.put( body );
    return byteBuffer.array();
}
 
Example 14
Project: android-chunk-utils   File: TypeChunk.java   View Source Code Vote up 5 votes
@Override
protected void writeHeader(ByteBuffer output) {
  int entriesStart = getHeaderSize() + getOffsetSize();
  output.putInt(id);  // Write an unsigned byte with 3 bytes padding
  output.putInt(entryCount);
  output.putInt(entriesStart);
  output.put(configuration.toByteArray(false));
}
 
Example 15
Project: monarch   File: Connection.java   View Source Code Vote up 4 votes
private void sendOKHandshakeReply() throws IOException, ConnectionException {
  byte[] my_okHandshakeBytes = null;
  ByteBuffer my_okHandshakeBuf = null;
  if (this.isReceiver) {
    DistributionConfig cfg = owner.getConduit().config;
    ByteBuffer bb;
    if (useNIO() && TCPConduit.useDirectBuffers) {
      bb = ByteBuffer.allocateDirect(128);
    } else {
      bb = ByteBuffer.allocate(128);
    }
    bb.putInt(0); // reserve first 4 bytes for packet length
    bb.put((byte) NORMAL_MSG_TYPE);
    bb.putShort(MsgIdGenerator.NO_MSG_ID);
    bb.put(REPLY_CODE_OK_WITH_ASYNC_INFO);
    bb.putInt(cfg.getAsyncDistributionTimeout());
    bb.putInt(cfg.getAsyncQueueTimeout());
    bb.putInt(cfg.getAsyncMaxQueueSize());
    // write own product version
    Version.writeOrdinal(bb, Version.CURRENT.ordinal(), true);
    // now set the msg length into position 0
    bb.putInt(0, calcHdrSize(bb.position() - MSG_HEADER_BYTES));
    if (useNIO()) {
      my_okHandshakeBuf = bb;
      bb.flip();
    } else {
      my_okHandshakeBytes = new byte[bb.position()];
      bb.flip();
      bb.get(my_okHandshakeBytes);
    }
  } else {
    my_okHandshakeBuf = okHandshakeBuf;
    my_okHandshakeBytes = okHandshakeBytes;
  }
  if (useNIO()) {
    synchronized (my_okHandshakeBuf) {
      my_okHandshakeBuf.position(0);
      nioWriteFully(getSocket().getChannel(), my_okHandshakeBuf, false, null);
    }
  } else {
    synchronized (outLock) {
      try {
        // this.writerThread = Thread.currentThread();
        this.output.write(my_okHandshakeBytes, 0, my_okHandshakeBytes.length);
        this.output.flush();
      } finally {
        // this.writerThread = null;
      }
    }
  }
}
 
Example 16
Project: openjdk-jdk10   File: FramesEncoder.java   View Source Code Vote up 4 votes
private void putPriority(ByteBuffer buf, boolean exclusive, int streamDependency, int weight) {
    buf.putInt(exclusive ? (1 << 31) + streamDependency : streamDependency);
    buf.put((byte) weight);
}
 
Example 17
Project: multiple-dimension-spread   File: ConstantColumnBinaryMaker.java   View Source Code Vote up 4 votes
public static ColumnBinary createColumnBinary( final PrimitiveObject value , final String columnName , final int size ) throws IOException{
  ColumnType type;
  byte[] valueBinary;
  int logicalDataSize;
  switch( value.getPrimitiveType() ){
    case BOOLEAN:
      type = ColumnType.BOOLEAN;
      valueBinary = new byte[Byte.BYTES];
      if( value.getBoolean() ){
        valueBinary[0] = 1;
      }
      logicalDataSize = Byte.BYTES * size;
      break;
    case BYTE:
      type = ColumnType.BYTE;
      valueBinary = new byte[Byte.BYTES];
      valueBinary[0] = value.getByte();
      logicalDataSize = Byte.BYTES * size;
      break;
    case SHORT:
      type = ColumnType.SHORT;
      valueBinary = new byte[Short.BYTES];
      ByteBuffer.wrap( valueBinary ).putShort( value.getShort() );
      logicalDataSize = Short.BYTES * size;
      break;
    case INTEGER:
      type = ColumnType.INTEGER;
      valueBinary = new byte[Integer.BYTES];
      ByteBuffer.wrap( valueBinary ).putInt( value.getInt() );
      logicalDataSize = Integer.BYTES * size;
      break;
    case LONG:
      type = ColumnType.LONG;
      valueBinary = new byte[Long.BYTES];
      ByteBuffer.wrap( valueBinary ).putLong( value.getLong() );
      logicalDataSize = Long.BYTES * size;
      break;
    case FLOAT:
      type = ColumnType.FLOAT;
      valueBinary = new byte[Float.BYTES];
      ByteBuffer.wrap( valueBinary ).putFloat( value.getFloat() );
      logicalDataSize = Float.BYTES * size;
      break;
    case DOUBLE:
      type = ColumnType.DOUBLE;
      valueBinary = new byte[Double.BYTES];
      ByteBuffer.wrap( valueBinary ).putDouble( value.getDouble() );
      logicalDataSize = Double.BYTES * size;
      break;
    case STRING:
      type = ColumnType.STRING;
      byte[] stringBytes = value.getBytes();
      valueBinary = new byte[Integer.BYTES + stringBytes.length];
      ByteBuffer stringWrapBuffer = ByteBuffer.wrap( valueBinary );
      stringWrapBuffer.putInt( stringBytes.length );
      stringWrapBuffer.put( stringBytes );
      logicalDataSize = ( stringBytes.length * Character.BYTES ) * size;
      break;
    case BYTES:
      type = ColumnType.BYTES;
      byte[] bytes = value.getBytes();
      valueBinary = new byte[Integer.BYTES + bytes.length];
      ByteBuffer wrapBuffer = ByteBuffer.wrap( valueBinary );
      wrapBuffer.putInt( bytes.length );
      wrapBuffer.put( bytes );
      logicalDataSize = bytes.length * size;
      break;
    default:
      throw new IOException( "Unknown primitive type." );
  }

  return new ColumnBinary( ConstantColumnBinaryMaker.class.getName() , DefaultCompressor.class.getName() , columnName , type , size , valueBinary.length , logicalDataSize , 1 , valueBinary , 0 , valueBinary.length , null );
}
 
Example 18
Project: apkfile   File: ResourceTableChunk.java   View Source Code Vote up 4 votes
@Override
protected void writeHeader(ByteBuffer output) {
    super.writeHeader(output);
    output.putInt(packages.size());
}
 
Example 19
Project: fuck_zookeeper   File: CnxManagerTest.java   View Source Code Vote up 4 votes
/**
 * Tests a bug in QuorumCnxManager that causes a spin lock
 * when a negative value is sent. This test checks if the 
 * connection is being closed upon a message with negative
 * length.
 * 
 * @throws Exception
 */
@Test
public void testCnxManagerSpinLock() throws Exception {               
    QuorumPeer peer = new QuorumPeer(peers, peerTmpdir[1], peerTmpdir[1], peerClientPort[1], 3, 1, 1000, 2, 2);
    QuorumCnxManager cnxManager = new QuorumCnxManager(peer);
    QuorumCnxManager.Listener listener = cnxManager.listener;
    if(listener != null){
        listener.start();
    } else {
        LOG.error("Null listener when initializing cnx manager");
    }
    
    int port = peers.get(peer.getId()).electionAddr.getPort();
    LOG.info("Election port: " + port);
    InetSocketAddress addr = new InetSocketAddress(port);
    
    Thread.sleep(1000);
    
    SocketChannel sc = SocketChannel.open();
    sc.socket().connect(peers.get(new Long(1)).electionAddr, 5000);
    
    /*
     * Write id first then negative length.
     */
    byte[] msgBytes = new byte[8];
    ByteBuffer msgBuffer = ByteBuffer.wrap(msgBytes);
    msgBuffer.putLong(new Long(2));
    msgBuffer.position(0);
    sc.write(msgBuffer);
    
    msgBuffer = ByteBuffer.wrap(new byte[4]);
    msgBuffer.putInt(-20);
    msgBuffer.position(0);
    sc.write(msgBuffer);
    
    Thread.sleep(1000);
    
    try{
        /*
         * Write a number of times until it
         * detects that the socket is broken.
         */
        for(int i = 0; i < 100; i++){
            msgBuffer.position(0);
            sc.write(msgBuffer);
        }
        Assert.fail("Socket has not been closed");
    } catch (Exception e) {
        LOG.info("Socket has been closed as expected");
    }
    peer.shutdown();
    cnxManager.halt();
}
 
Example 20
Project: soapbox-race-core   File: LobbyBO.java   View Source Code Vote up 4 votes
public void run() {
	try {
		Thread.sleep(60000);
	} catch (Exception e) {
		System.out.println(e.getMessage());
	}
	LobbyEntity lobbyEntity = lobbyDao.findById(lobbyId);
	List<LobbyEntrantEntity> entrants = lobbyEntity.getEntrants();
	if (entrants.size() < 2) {
		return;
	}
	Collections.sort(entrants);
	XMPP_LobbyLaunchedType lobbyLaunched = new XMPP_LobbyLaunchedType();
	Entrants entrantsType = new Entrants();
	List<LobbyEntrantInfo> lobbyEntrantInfo = entrantsType.getLobbyEntrantInfo();
	XMPP_CryptoTicketsType xMPP_CryptoTicketsType = new XMPP_CryptoTicketsType();
	List<XMPP_P2PCryptoTicketType> p2pCryptoTicket = xMPP_CryptoTicketsType.getP2PCryptoTicket();
	int i = 0;
	byte numOfRacers = (byte) entrants.size();
	EventSessionEntity eventDataEntity = new EventSessionEntity();
	eventDataEntity.setEvent(lobbyEntity.getEvent());
	eventSessionDao.insert(eventDataEntity);
	for (LobbyEntrantEntity lobbyEntrantEntity : entrants) {
		// eventDataEntity.setIsSinglePlayer(false);
		Long personaId = lobbyEntrantEntity.getPersona().getPersonaId();
		// eventDataEntity.setPersonaId(personaId);
		byte gridIndex = (byte) i;
		byte[] helloPacket = { 10, 11, 12, 13 };
		ByteBuffer byteBuffer = ByteBuffer.allocate(48);
		byteBuffer.put(gridIndex);
		byteBuffer.put(helloPacket);
		byteBuffer.putInt(eventDataEntity.getId().intValue());
		byteBuffer.put(numOfRacers);
		byteBuffer.putInt(personaId.intValue());
		byte[] cryptoTicketBytes = byteBuffer.array();
		String relayCrypotTicket = Base64.getEncoder().encodeToString(cryptoTicketBytes);
		tokenDAO.updateRelayCrytoTicketByPersonaId(personaId, relayCrypotTicket);

		XMPP_P2PCryptoTicketType p2pCryptoTicketType = new XMPP_P2PCryptoTicketType();
		p2pCryptoTicketType.setPersonaId(personaId);
		p2pCryptoTicketType.setSessionKey("AAAAAAAAAAAAAAAAAAAAAA==");
		p2pCryptoTicket.add(p2pCryptoTicketType);

		LobbyEntrantInfo lobbyEntrantInfoType = new LobbyEntrantInfo();
		lobbyEntrantInfoType.setPersonaId(personaId);
		lobbyEntrantInfoType.setLevel(lobbyEntrantEntity.getPersona().getLevel());
		lobbyEntrantInfoType.setHeat(1);
		lobbyEntrantInfoType.setGridIndex(i++);
		lobbyEntrantInfoType.setState(LobbyEntrantState.UNKNOWN);
		lobbyEntrantInfo.add(lobbyEntrantInfoType);
	}
	XMPP_EventSessionType xMPP_EventSessionType = new XMPP_EventSessionType();
	ChallengeType challengeType = new ChallengeType();
	challengeType.setChallengeId("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
	challengeType.setPattern("FFFFFFFFFFFFFFFF");
	challengeType.setLeftSize(14);
	challengeType.setRightSize(50);

	xMPP_EventSessionType.setEventId(lobbyEntity.getEvent().getId());
	xMPP_EventSessionType.setChallenge(challengeType);
	xMPP_EventSessionType.setSessionId(eventDataEntity.getId());
	lobbyLaunched.setNewRelayServer(true);
	lobbyLaunched.setLobbyId(lobbyEntity.getId());
	lobbyLaunched.setUdpRelayHost(Config.getUdpRaceIp());
	lobbyLaunched.setUdpRelayPort(Config.getUdpRacePort());

	lobbyLaunched.setEntrants(entrantsType);

	lobbyLaunched.setEventSession(xMPP_EventSessionType);
	XmppLobby.sendRelay(lobbyLaunched, xMPP_CryptoTicketsType);
}