private ByteBuffer parseByteString(InputStream is) throws IOException {

        int readChar = is.read();

        StringBuffer buff = new StringBuffer();
        do {
            if (readChar < 0) {
                throw new IOException("Unexpected EOF found");
            }
            buff.append((char) readChar);
            readChar = is.read();
        } while (readChar != ':');
        Integer length = Integer.parseInt(buff.toString());

        byte[] byteString = new byte[length];
        for (int i = 0; i < byteString.length; i++) {
            byteString[i] = (byte) is.read();
        // System.out.println("Loaded string: " + new String(byteString));
        }
        return ByteBuffer.wrap(byteString);
    }