- int64_t sequencenumber = slot.getSequenceNumber();
- char[] slotBytes = slot.encode(mac);
- // slotBytes = encryptCipher.doFinal(slotBytes);
-
- // char[] iVBytes = slot.getSlotCryptIV();
-
- // char[] chars = new char[slotBytes.length + IV_SIZE];
- // System.arraycopy(iVBytes, 0, chars, 0, iVBytes.length);
- // System.arraycopy(slotBytes, 0, chars, IV_SIZE, slotBytes.length);
-
-
- char[] chars = encryptSlotAndPrependIV(slotBytes, slot.getSlotCryptIV());
-
- url = buildRequest(true, sequencenumber, max);
-
- timer.startTime();
- con = url.openConnection();
- http = (HttpURLConnection) con;
-
- http.setRequestMethod("POST");
- http.setFixedLengthStreamingMode(chars.length);
- http.setDoOutput(true);
- http.setConnectTimeout(TIMEOUT_MILLIS);
- http.setReadTimeout(TIMEOUT_MILLIS);
- http.connect();
-
- OutputStream os = http.getOutputStream();
- os.write(chars);
- os.flush();
-
- timer.endTime();
-
-
- // System.out.println("Bytes Sent: " + chars.length);
- } catch (ServerException e) {
- timer.endTime();
-
+ int64_t sequencenumber = slot->getSequenceNumber();
+ Array<char> *slotBytes = slot->encode(mac);
+ Array<char> *chars = encryptSlotAndPrependIV(slotBytes, slot->getSlotCryptIV());
+ IoTString *url = buildRequest(true, sequencenumber, max);
+ timer->startTime();
+ fd = openURL(url, true);
+ writeURLData(fd, chars);
+ timer->endTime();
+ } catch (ServerException *e) {
+ timer->endTime();