Package javax.net.ssl

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


            assertEquals("Unexpected status of operation:",
                    SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING,
                    result.getHandshakeStatus());
            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.",
View Full Code Here


        // SSLException to be thrown.
        try {
            while (!not_allowed.getHandshakeStatus().equals(
                        SSLEngineResult.HandshakeStatus.NEED_WRAP)) {
                assertTrue("Engine did not consume any data",
                        result.bytesConsumed() > 0);
                if (not_allowed.getHandshakeStatus().equals(
                            SSLEngineResult.HandshakeStatus.NEED_TASK)) {
                    not_allowed.getDelegatedTask().run();
                    if (doLog) {
                        System.out.println("Status after the task: "
View Full Code Here

        // prepare for reading
        buffer.flip();
        try {
            print(result = allowed.unwrap(buffer, app_data_plain));
            assertTrue("Engine did not consume any data",
                    result.bytesConsumed() > 0);
            assertEquals("Responce from the peer not allowed to create "
                    + "the session did not cause the stopping of "
                    + "the session negotiation process",
                    SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING,
                    result.getHandshakeStatus());
View Full Code Here

        assertEquals("Unexpected status of operation:",
                SSLEngineResult.HandshakeStatus.NEED_UNWRAP,
                result.getHandshakeStatus());
        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
View Full Code Here

        assertEquals("Unexpected status of operation:",
                SSLEngineResult.HandshakeStatus.NEED_WRAP,
                result.getHandshakeStatus());
        assertTrue(
            "The length of the consumed data differs from expected",
            result.bytesConsumed() > 0);
        assertEquals(
            "The length of the received data differs from expected",
            0, result.bytesProduced());

        // prepare the buffer for writing
View Full Code Here

        assertEquals("Unexpected status of operation:",
                SSLEngineResult.HandshakeStatus.NEED_WRAP,
                result.getHandshakeStatus());
        assertEquals(
            "The length of the consumed data differs from expected",
            0, result.bytesConsumed());
        assertEquals(
            "The length of the received data differs from expected",
            0, result.bytesProduced());

        // prepare the buffer for writing
View Full Code Here

            e.wrap(bbs, bbd);
            fail("SSLException must be thrown");
        } catch (SSLException ex) {
        }
        SSLEngineResult res = e.wrap(bbd, bbs);
        assertEquals(10, res.bytesConsumed());
        assertEquals(20, res.bytesProduced());

        try {
            e.wrap(new ByteBuffer[] { bbs }, bbd);
            fail("SSLException must be thrown");
View Full Code Here

            e.wrap(new ByteBuffer[] { bbs }, bbd);
            fail("SSLException must be thrown");
        } catch (SSLException ex) {
        }
        res = e.wrap(new ByteBuffer[] { bbd }, bbs);
        assertEquals(10, res.bytesConsumed());
        assertEquals(20, res.bytesProduced());
    }

    /**
     * Test for <code>wrap(ByteBuffer src, ByteBuffer dst)</code> method
View Full Code Here

        int port = 8080;
        ByteBuffer bb = ByteBuffer.allocate(10);
        SSLEngine e = new mySSLEngine(host, port);
       
        SSLEngineResult res = e.wrap(bb, ByteBuffer.allocate(10));
        assertEquals(10, res.bytesConsumed());
        assertEquals(20, res.bytesProduced());
    }
   
    /**
     * Test for <code>wrap(ByteBuffer[] srcs, ByteBuffer dst)</code> method
View Full Code Here

        ByteBuffer[] bbA = { ByteBuffer.allocate(5), ByteBuffer.allocate(10), ByteBuffer.allocate(5) };

        SSLEngine e = new mySSLEngine(host, port);

        SSLEngineResult res = e.wrap(bbA, bb);
        assertEquals(10, res.bytesConsumed());
        assertEquals(20, res.bytesProduced());
    }
   
    /**
     * Test for <code>unwrap(ByteBuffer src, ByteBuffer dst)</code> method
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.