@Override
    public void readFrame(Buffer buffer) {
      // example data:
      // --ssBoundary8345
      // Content-Type: image/jpeg
      // Content-Length: 114587

      try {
        String line;
        // eat leading blank lines
        while (true) {
          line = readLine(MAX_LINE_LENGTH);
          if (line == null) {
            buffer.setEOM(true);
            buffer.setLength(0);
            return;
          }

          if (!line.trim().equals("")) break; // end of header
        }

        if (boundary == null) {
          boundary = line.trim(); // TODO: we should be able to get
          // this from the content type, but
          // the content type has this
          // stripped out. So we'll just take
          // the first nonblank line to be the
          // boundary.
          // System.out.println("boundary: " + boundary);
        } else {
          if (!line.trim().equals(boundary)) {
            // throw new IOException("Expected boundary: " +
            // toPrintable(line));
            // TODO: why do we seem to get these when playing back
            // mmr files recorded using FmjTranscode?
            logger.warning("Expected boundary (frame " + framesRead + "): " + toPrintable(line));

            // handle streams that are truncated in the middle of a
            // frame:
            final int eatResult = eatUntil(boundary); // TODO: no
            // need to
            // store the
            // data

            logger.info(
                "Ignored bytes (eom after="
                    + (eatResult < 0)
                    + "): "
                    + (eatResult < 0 ? (-1 * eatResult - 1) : eatResult));
            if (eatResult < 0) {
              buffer.setEOM(true);
              buffer.setLength(0);
              return;
            }

            // now read boundary
            line = readLine(MAX_LINE_LENGTH);
            if (!line.trim().equals(boundary)) {
              throw new RuntimeException("No boundary found after eatUntil(boundary)"); // should
              // never
              // happen
            }
          }
        }

        final Properties properties = new Properties();

        while (true) {
          line = readLine(MAX_LINE_LENGTH);
          if (line == null) {
            buffer.setEOM(true);
            buffer.setLength(0);
            return;
          }

          if (line.trim().equals("")) break; // end of header

          if (!parseProperty(line, properties))
            throw new IOException("Expected property: " + toPrintable(line));
        }

        final String contentType = properties.getProperty("Content-Type".toUpperCase());
        if (contentType == null) {
          logger.warning("Header properties: " + properties);
          throw new IOException("Expected Content-Type in header");
        }

        // check supported content types:
        if (!isSupportedFrameContentType(contentType)) {
          throw new IOException("Unsupported Content-Type: " + contentType);
        }

        if (frameContentType == null) {
          frameContentType = contentType;
        } else {
          if (!contentType.equals(frameContentType))
            throw new IOException(
                "Content type changed during stream from "
                    + frameContentType
                    + " to "
                    + contentType);
        }

        // TODO: check that size doesn't change throughout

        final byte[] data;

        final String contentLenStr = properties.getProperty("Content-Length".toUpperCase());
        if (contentLenStr != null) { // if we know the content length, use it
          final int contentLen;
          try {
            contentLen = Integer.parseInt(contentLenStr);
          } catch (NumberFormatException e) {
            throw new IOException("Invalid content length: " + contentLenStr);
          }

          // now, read the content-length bytes
          data = readFully(contentLen); // TODO: don't realloc each
          // time
        } else {
          // if we don't know the content length, just read until we
          // find the boundary.
          // Some IP cameras don't specify it, like
          // http://webcam-1.duesseldorf.it-on.net/cgi-bin/nph-update.cgi
          data = readUntil(boundary);
        }

        // ext
        final String timestampStr = properties.getProperty(TIMESTAMP_KEY.toUpperCase());
        if (timestampStr != null) {
          try {
            final long timestamp = Long.parseLong(timestampStr);
            buffer.setTimeStamp(timestamp);

          } catch (NumberFormatException e) {
            logger.log(Level.WARNING, "" + e, e);
          }
        }

        if (data == null) {
          buffer.setEOM(true);
          buffer.setLength(0);
          return;
        }

        buffer.setData(data);
        buffer.setOffset(0);
        buffer.setLength(data.length);
        ++framesRead;

      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  public void get_wallet_balance() { // **********************

    System.out.println("Get Balance...");

    rpcurl = lm.carbon_settings[10];

    rpcaddress = lm.rpcaddress_confirm;

    rpcuser = lm.carbon_settings[12];
    rpcpassword = lm.carbon_settings[13];

    System.out.println(rpcuser);
    System.out.println(rpcpassword);
    System.out.println(rpcaddress);

    String line = new String();
    String line2 = new String();

    String url1 =
        new String(
            "https://blockchain.info/merchant/"
                + rpcuser
                + "/address_balance?password="******"&address="
                + rpcaddress
                + "&confirmations=6");

    try {

      // Sets the authenticator that will be used by the networking code
      // when a proxy or an HTTP server asks for authentication.

      // Authenticator.setDefault(new CustomAuthenticator());
      System.out.println("GO0");

      URL url = new URL(url1);
      HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();

      System.out.println("GO1");

      // read text returned by server
      BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      // BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
      // BufferedReader in = new BufferedReader(null);

      while ((line = in.readLine()) != null) {

        System.out.println(line);
        line2 = line2 + line;
      }

      in.close();

      JSONParser parser = new JSONParser();

      try {

        Object obj = parser.parse(line2);

        JSONObject jsonObject = (JSONObject) obj;

        String address = (String) jsonObject.get("address");
        System.out.println(address);

        String balance = (String) jsonObject.get("balance").toString();
        System.out.println(balance);
        lm.wallet_value_confirm = (long) Long.parseLong(balance);
        System.out.println("lm.wallet_value_confirm " + lm.wallet_value_confirm);

      } // try
      catch (ParseException e) {
        e.printStackTrace();
      }

    } // try
    catch (MalformedURLException e) {
      System.out.println("Malformed URL: " + e.getMessage());
    } catch (IOException e) {
      System.out.println("I/O Error: " + e.getMessage());
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
  } // ***************test_for_sales()