Package javax.net.ssl

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


                                // pass the decrypted data to the application, which will perform
                                // another call to fill() or flush().
                                if (unwrapResult.bytesProduced() > 0)
                                {
                                    if (app_in == buffer)
                                        return unwrapResult.bytesProduced();
                                    return BufferUtil.flipPutFlip(_decryptedInput, buffer);
                                }

                                switch (handshakeStatus)
                                {
View Full Code Here


                                if (!outAppBuf.hasRemaining()) {
                                    pendingUnencryptedWrites.remove();
                                }
                            }

                            if (result.bytesProduced() > 0) {
                                outNetBuf.flip();
                                int remaining = outNetBuf.remaining();
                                msg = ctx.getChannel().getConfig().getBufferFactory().getBuffer(remaining);

                                // Transfer the bytes to the new ChannelBuffer using some safe method that will also
View Full Code Here

            for (;;) {
                synchronized (handshakeLock) {
                    result = engine.wrap(EMPTY_BUFFER, outNetBuf);
                }

                if (result.bytesProduced() > 0) {
                    outNetBuf.flip();
                    ChannelBuffer msg =
                            ctx.getChannel().getConfig().getBufferFactory().getBuffer(outNetBuf.remaining());

                    // Transfer the bytes to the new ChannelBuffer using some safe method that will also
View Full Code Here

                default:
                    throw new IllegalStateException(
                            "Unexpected handshake status: " + handshakeStatus);
                }

                if (result.bytesProduced() == 0) {
                    break;
                }
            }
        } catch (SSLException e) {
            setHandshakeFailure(channel, e);
View Full Code Here

            //compact the buffer
            netInBuffer.compact();
           
            if ( unwrap.getStatus()==Status.OK || unwrap.getStatus()==Status.BUFFER_UNDERFLOW ) {
                //we did receive some data, add it to our total
                read += unwrap.bytesProduced();
                //perform any tasks if needed
                if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks();
                //if we need more network data, then bail out for now.
                if ( unwrap.getStatus() == Status.BUFFER_UNDERFLOW ) break;
            }else {
View Full Code Here

            //compact the buffer
            netInBuffer.compact();
           
            if ( unwrap.getStatus()==Status.OK || unwrap.getStatus()==Status.BUFFER_UNDERFLOW ) {
                //we did receive some data, add it to our total
                read += unwrap.bytesProduced();
                //perform any tasks if needed
                if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks();
                //if we need more network data, then bail out for now.
                if ( unwrap.getStatus() == Status.BUFFER_UNDERFLOW ) break;
            }else if ( unwrap.getStatus()==Status.BUFFER_OVERFLOW && read>0 ) {
View Full Code Here

            //compact the buffer
            netInBuffer.compact();

            if ( unwrap.getStatus()==Status.OK || unwrap.getStatus()==Status.BUFFER_UNDERFLOW ) {
                //we did receive some data, add it to our total
                read += unwrap.bytesProduced();
                //perform any tasks if needed
                if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks();
                //if we need more network data, then bail out for now.
                if ( unwrap.getStatus() == Status.BUFFER_UNDERFLOW ) break;
            }else if ( unwrap.getStatus()==Status.BUFFER_OVERFLOW && read>0 ) {
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);
        if (doLog) {
            System.out.println(
                    "\nClient tries to send data after closure alert");
        }
        // this data will not be sent (should do nothing - 0 cons, 0 prod)
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 buffers for reading
        app_data_buffer.clear();
        buffer.flip();
View Full Code Here

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

        if (doLog) {
            System.out.println("\nServer tries to read after closure");
        }
        // will be ignored
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.