Java Code Examples for sun.security.ssl.ProtocolVersion#valueOf()

The following examples show how to use sun.security.ssl.ProtocolVersion#valueOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LengthCheckTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 2
Source File: LengthCheckTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 3
Source File: LengthCheckTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 4
Source File: LengthCheckTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 5
Source File: LengthCheckTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 6
Source File: LengthCheckTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 7
Source File: LengthCheckTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 8
Source File: LengthCheckTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 9
Source File: LengthCheckTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 10
Source File: LengthCheckTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}
 
Example 11
Source File: LengthCheckTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hex-dumps a ByteBuffer to stdout.
 */
private static void dumpByteBuffer(String header, ByteBuffer bBuf) {
    if (dumpBufs == false) {
        return;
    }

    int bufLen = bBuf.remaining();
    if (bufLen > 0) {
        bBuf.mark();

        // We expect the position of the buffer to be at the
        // beginning of a TLS record.  Get the type, version and length.
        int type = Byte.toUnsignedInt(bBuf.get());
        int ver_major = Byte.toUnsignedInt(bBuf.get());
        int ver_minor = Byte.toUnsignedInt(bBuf.get());
        int recLen = Short.toUnsignedInt(bBuf.getShort());
        ProtocolVersion pv = ProtocolVersion.valueOf(ver_major, ver_minor);

        log("===== " + header + " (" + tlsRecType(type) + " / " +
            pv + " / " + bufLen + " bytes) =====");
        bBuf.reset();
        for (int i = 0; i < bufLen; i++) {
            if (i != 0 && i % 16 == 0) {
                System.out.print("\n");
            }
            System.out.format("%02X ", bBuf.get(i));
        }
        log("\n===============================================");
        bBuf.reset();
    }
}