Package javax.net.ssl

Examples of javax.net.ssl.SSLEngine.unwrap()


    public void testUnwrap04() throws SSLException {
        String host = "new host";
        int port = 8080;
        ByteBuffer bb = ByteBuffer.allocate(10);
        SSLEngine e = new mySSLEngine(host, port);
        SSLEngineResult res = e.unwrap(bb, ByteBuffer.allocate(10));
       
        assertEquals(1, res.bytesConsumed());
        assertEquals(2, res.bytesProduced());
    }
   
View Full Code Here


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

        ByteBuffer bb = ByteBuffer.allocate(10);
        SSLEngine e = new mySSLEngine(host, port);

        SSLEngineResult res = e.unwrap(bb, bbA);
        assertEquals(1, res.bytesConsumed());
        assertEquals(2, res.bytesProduced());
    }
}
View Full Code Here

        if (doLog) {
            System.out.println("\nError processing test:");
        }
        try {
            print(server.unwrap(ByteBuffer.allocate(40), app_data_buffer));
            fail("Expected exception was not thrown.");
        } catch (Exception e) {
            if (doLog) {
                System.out.println("\nServer threw exception: "
                        +e.getMessage());
View Full Code Here

            if (doLog) {
                System.out.println(
                        "\nServer tries to unwrap the data after error");
            }
            print(result =
                    server.unwrap(ByteBuffer.allocate(40), app_data_buffer));
            assertEquals("Unexpected status of operation:",
                    SSLEngineResult.Status.CLOSED,
                    result.getStatus());
            assertEquals("Unexpected status of operation:",
                    SSLEngineResult.HandshakeStatus.NEED_WRAP,
View Full Code Here

                        fail("Both engines are in NEED_UNWRAP state");
                    }
                    continue;
                }

                print(result = current_engine.unwrap(buffer, app_data));
                if (current_engine.getHandshakeStatus()
                        == SSLEngineResult.HandshakeStatus.NEED_TASK) {
                    if (doLog) {
                        System.out.println("NEED_TASK");
                    }
View Full Code Here

        if (doLog) {
            System.out.println("\nError processing test:");
        }
        try {
            print(server.unwrap(ByteBuffer.allocate(40), app_data_buffer));
            fail("Expected exception was not thrown.");
        } catch (Exception e) {
            if (doLog) {
                System.out.println("\nServer threw exception: "
                        +e.getMessage());
View Full Code Here

            if (doLog) {
                System.out.println(
                        "\nServer tries to unwrap the data after error");
            }
            print(result =
                    server.unwrap(ByteBuffer.allocate(40), app_data_buffer));
            assertEquals("Unexpected status of operation:",
                    SSLEngineResult.Status.CLOSED,
                    result.getStatus());
            assertEquals("Unexpected status of operation:",
                    SSLEngineResult.HandshakeStatus.NEED_WRAP,
View Full Code Here

                        fail("Both engines are in NEED_UNWRAP state");
                    }
                    continue;
                }

                print(result = current_engine.unwrap(buffer, app_data));
                if (current_engine.getHandshakeStatus()
                        == SSLEngineResult.HandshakeStatus.NEED_TASK) {
                    if (doLog) {
                        System.out.println("NEED_TASK");
                    }
View Full Code Here

        int port = 8080;
        ByteBuffer bbN = null;
        ByteBuffer bb = ByteBuffer.allocate(10);
        SSLEngine e = new mySSLEngine(host, port);

        e.unwrap(bbN, bb);
        e.unwrap(bb, bbN);

        ByteBuffer roBb = bb.asReadOnlyBuffer();
        assertTrue("Not read only byte buffer", roBb.isReadOnly());
View Full Code Here

        ByteBuffer bbN = null;
        ByteBuffer bb = ByteBuffer.allocate(10);
        SSLEngine e = new mySSLEngine(host, port);

        e.unwrap(bbN, bb);
        e.unwrap(bb, bbN);

        ByteBuffer roBb = bb.asReadOnlyBuffer();
        assertTrue("Not read only byte buffer", roBb.isReadOnly());

        e.unwrap(bb, roBb);
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.