Package javax.net.ssl

Examples of javax.net.ssl.SSLEngineResult.bytesProduced()


            assertEquals(
                "The length of the consumed data differs from expected",
                0, result.bytesConsumed());
            assertTrue(
                "The length of the produced data differs from expected",
                result.bytesProduced() > 0);
            // tune buffer to be read
            buffer.flip();
            try {
                // should rethrow the SSLException "internal error"
                print(client.unwrap(buffer, app_data_buffer));
View Full Code Here


            assertEquals(
                "The length of the consumed data differs from expected",
                0, result.bytesConsumed());
            assertEquals(
                "The length of the produced data differs from expected",
                0, result.bytesProduced());

            if (doLog) {
                System.out.println("\nServer wraps the fatal alert");
            }
            print(result = server.wrap(ByteBuffer.allocate(0), buffer));
View Full Code Here

            assertEquals(
                "The length of the consumed data differs from expected",
                0, result.bytesConsumed());
            assertTrue(
                "The length of the produced data differs from expected",
                result.bytesProduced() > 0);

            assertTrue("Outbound should be closed.",
                    server.isOutboundDone());
            assertTrue("Inbound should be closed.",
                    server.isInboundDone());
View Full Code Here

                    print(result = current_engine.wrap(
                                ByteBuffer.wrap(new byte[] {0}), app_data));
                    // The output in app_data will be produced only if it
                    // is rehandshaking stage
                    // (i.e. initial handshake has been done)
                    if (result.bytesProduced() > 0) {
                        // if the app data message has been produced,
                        // unwrap it by another peer
                        if (doLog) {
                            System.out.print("\n" + ((current_engine != client)
                                                     ? "CLIENT " : "SERVER "));
View Full Code Here

        // wrap the initial session negotiation message
        while (allowed.getHandshakeStatus().equals(
                    SSLEngineResult.HandshakeStatus.NEED_WRAP)) {
            print(result = allowed.wrap(app_data_plain, buffer));
            assertTrue("Engine did not produce any data",
                    result.bytesProduced() > 0);
        }
        // prepare the buffer for reading
        buffer.flip();
        if (doLog) {
            System.out.println("\nNot allowed unwraps the message");
View Full Code Here

                print(result = not_allowed.wrap(app_data_plain, buffer));
            }
        }
        // check whether alert message has been sent
        assertTrue("Engine did not produce any data",
                result.bytesProduced() > 0);
        // check whether not_allowed engine stoped handshake operation
        assertEquals("Unexpected status of operation: not_allowed "
                + "to session creation peer did not stop its handshake process",
                SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING,
                not_allowed.getHandshakeStatus());
View Full Code Here

        assertEquals("Unexpected status of operation:",
                SSLEngineResult.Status.OK,
                result.getStatus());
        assertEquals(
            "The length of the received data differs from expected",
            "data to be sent".length(), result.bytesProduced());

        // take the data from the buffer
        byte[] resulting_data = new byte[result.bytesProduced()];
        si.rewind();
        si.get(resulting_data);
View Full Code Here

        assertEquals(
            "The length of the received data differs from expected",
            "data to be sent".length(), result.bytesProduced());

        // take the data from the buffer
        byte[] resulting_data = new byte[result.bytesProduced()];
        si.rewind();
        si.get(resulting_data);
        si.clear();
        assertTrue(Arrays.equals(data_2b_sent.getBytes(), resulting_data));
View Full Code Here

            assertEquals("Unexpected status of operation:",
                    SSLEngineResult.Status.OK,
                    result.getStatus());
            assertEquals(
                "The length of the received data differs from expected",
                i, result.bytesProduced());
            resulting_data = new byte[i];
            si.rewind();
            si.get(resulting_data);
            si.clear();
            assertTrue(Arrays.equals(buff, resulting_data));
View Full Code Here

        assertEquals(
            "The length of the consumed data differs from expected",
            0, result.bytesConsumed());
        assertEquals(
            "The length of the produced data differs from expected",
            0, result.bytesProduced());

        // prepare the buffer for reading
        buffer.flip();

        if (doLog) {
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.