Package java.util

Examples of java.util.Random.nextBytes()


        "sleep").getRequest());
      Random rand = new Random();
      params.put("millis", Math.abs(rand.nextLong()) % 1000);
      int payloadSize = Math.abs(rand.nextInt()) % 10000;
      byte[] payload = new byte[payloadSize];
      rand.nextBytes(payload);
      params.put("data", ByteBuffer.wrap(payload));
      req.request("sleep", params);
    }
  }
}
View Full Code Here


        Random rng = new Random();
        ByteBuffer[] uuids = new ByteBuffer[100];
        for (int i = 0; i < uuids.length; i++)
        {
            uuids[i] = ByteBuffer.allocate(16);
            rng.nextBytes(uuids[i].array());
            // set version to 1
            uuids[i].array()[6] &= 0x0F;
            uuids[i].array()[6] |= 0x10;
        }
        Arrays.sort(uuids, timeUUIDType);
View Full Code Here

  @Test
  public void testEchoBytes() throws IOException {
    Random random = new Random();
    int length = random.nextInt(1024*16);
    ByteBuffer data = ByteBuffer.allocate(length);
    random.nextBytes(data.array());
    data.flip();
    ByteBuffer echoed = proxy.echoBytes(data);
    assertEquals(data, echoed);
  }

View Full Code Here

    Random random = new Random();
    int length = random.nextInt(1024*16);
    GenericRecord params =
      new GenericData.Record(PROTOCOL.getMessages().get("echoBytes").getRequest());
    ByteBuffer data = ByteBuffer.allocate(length);
    random.nextBytes(data.array());
    data.flip();
    params.put("data", data);
    Object echoed = requestor.request("echoBytes", params);
    assertEquals(data, echoed);
  }
View Full Code Here

   @Test
   public void testT10VendorIdentification() throws IOException
   {
      byte[] t10VendorIdentification = new byte[8];
      Random random = new Random();
      random.nextBytes(t10VendorIdentification);

      ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
      DataOutputStream dataOut = new DataOutputStream(byteOut);

      // First 8 bytes
View Full Code Here

   @Test
   public void testProductIdentification() throws IOException
   {
      byte[] productIdentification = new byte[16];
      Random random = new Random();
      random.nextBytes(productIdentification);

      ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
      DataOutputStream dataOut = new DataOutputStream(byteOut);

      // First 16 bytes
View Full Code Here

   @Test
   public void testProductRevisionLevel() throws IOException
   {
      byte[] productRevisionLevel = new byte[4];
      Random random = new Random();
      random.nextBytes(productRevisionLevel);

      ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
      DataOutputStream dataOut = new DataOutputStream(byteOut);

      // First 32 bytes
View Full Code Here

        final ByteBuffer writeData1 = ByteBuffer.allocate(512 * numBlocks);
        final ByteBuffer readData1 = ByteBuffer.allocate(512 * numBlocks);
        final ByteBuffer writeData2 = ByteBuffer.allocate(512 * numBlocks);
        final ByteBuffer readData2 = ByteBuffer.allocate(512 * numBlocks);
        Random random = new Random(System.currentTimeMillis());
        random.nextBytes(writeData1.array());
        random.nextBytes(writeData2.array());

        // init of initiator and the session
        String target1 = "testing-xen2-disk1";
        String target2 = "testing-xen2-disk2";
View Full Code Here

        final ByteBuffer readData1 = ByteBuffer.allocate(512 * numBlocks);
        final ByteBuffer writeData2 = ByteBuffer.allocate(512 * numBlocks);
        final ByteBuffer readData2 = ByteBuffer.allocate(512 * numBlocks);
        Random random = new Random(System.currentTimeMillis());
        random.nextBytes(writeData1.array());
        random.nextBytes(writeData2.array());

        // init of initiator and the session
        String target1 = "testing-xen2-disk1";
        String target2 = "testing-xen2-disk2";
        Initiator initiator = new Initiator(Configuration.create());
View Full Code Here

        int numBlocks = 50;
        int address = 12345;
        ByteBuffer writeData = ByteBuffer.allocate(512 * numBlocks);
        ByteBuffer readData = ByteBuffer.allocate(512 * numBlocks);
        Random random = new Random(System.currentTimeMillis());
        random.nextBytes(writeData.array());

        // init of initiator and the session
        String target = "testing-xen2-disk1";
        Initiator initiator = new Initiator(Configuration.create());
        initiator.createSession(target);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.