Examples of WriteRequest


Examples of org.apache.mina.session.WriteRequest

                    done = true;
                    break;
                case CLOSED:
                case OK:
                    appBuffer.flip();
                    WriteRequest writeRequest = new DefaultWriteRequest(readBuffer);
                    writeRequest.setMessage(appBuffer);
                    session.enqueueWriteRequest(writeRequest);
                    break;
                }
            }
        }
View Full Code Here

Examples of org.apache.mina.session.WriteRequest

                    break;

                case OK:
                    // We are done. Flip the buffer and push it to the write queue.
                    appBuffer.flip();
                    WriteRequest request = new DefaultWriteRequest(appBuffer);

                    return request;
                }
            }
        } catch (SSLException se) {
View Full Code Here

Examples of org.apache.mina.session.WriteRequest

            do {
                // get a write request from the queue. We left it in the queue,
                // just in case we can't write all of the message content into
                // the channel : we will have to retrieve the message later
                final WriteRequest writeRequest = writeQueue.peek();

                if (writeRequest == null) {
                    // Nothing to write : we are done
                    break;
                }

                // The message is necessarily a ByteBuffer at this point
                ByteBuffer buf = (ByteBuffer) writeRequest.getMessage();

                // Note that if the connection is secured, the buffer
                // already contains encrypted data.

                // Try to write the data, and get back the number of bytes
                // actually written
                int written = ((SocketChannel) channel).write(buf);

                if (IS_DEBUG) {
                    LOG.debug("wrote {} bytes to {}", written, this);
                }

                if (written > 0) {
                    incrementWrittenBytes(written);
                }

                // Update the idle status for this session
                idleChecker.sessionWritten(this, System.currentTimeMillis());

                // Ok, we may not have written everything. Check that.
                if (buf.remaining() == 0) {
                    // completed write request, let's remove it (we use poll() instead
                    // of remove(), because remove() may throw an exception if the
                    // queue is empty.
                    writeQueue.poll();

                    // complete the future if we have one (we should...)
                    final DefaultWriteFuture future = (DefaultWriteFuture) writeRequest.getFuture();

                    if (future != null) {
                        future.complete();
                    }
View Full Code Here

Examples of org.apache.mina.session.WriteRequest

        when(session.getAttribute(new AttributeKey<Object>(Object.class, "internal_encoder")))
                .thenReturn(encodingState);

        Object toEncode = new Object();
        WriteRequest wrq = mock(WriteRequest.class);
        when(wrq.getMessage()).thenReturn(toEncode);

        when(encoder.encode(toEncode, encodingState)).thenReturn(buff);

        WriteFilterChainController ctrl = mock(WriteFilterChainController.class);
View Full Code Here

Examples of org.hxzon.asn1.mms.sequence.WriteRequest

        case Tag.CONTEXT | 3:
            return new RenameRequest().init("rename", "rename", tag, stream);
        case Tag.CONTEXT | 4:
            return new ReadRequest().init("read", "read", tag, stream);
        case Tag.CONTEXT | 5:
            return new WriteRequest().init("write", "write", tag, stream);
        case Tag.CONTEXT | 6:
            return new GetVariableAccessAttributesRequest().init("getVariableAccessAttributes", "getVariableAccessAttributes", tag, stream, true);
        case Tag.CONTEXT | 7:
            return new DefineNamedVariableRequest().init("defineNamedVariable", "defineNamedVariable", tag, stream);
        case Tag.CONTEXT | 8:
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.