Package org.apache.mina.core.buffer

Examples of org.apache.mina.core.buffer.IoBuffer.flip()


                logger.debug("  sending SOCKS4a request");
            } else {
                logger.debug("  sending SOCKS4 request");
            }

            buf.flip();
            writeData(nextFilter, buf);
        } catch (Exception ex) {
            closeSession("Unable to send Socks request: ", ex);
        }
    }
View Full Code Here


                                .startSsl(session);

                        // Send a response
                        buf = IoBuffer.allocate(1);
                        buf.put((byte) '.');
                        buf.flip();
                        session.setAttribute(SslFilter.DISABLE_ENCRYPTION_ONCE);
                        session.write(buf);
                    } else {
                        super.messageReceived(session, message);
                    }
View Full Code Here

            // Test if we can enter TLS mode again.
            //// Send StartTLS request.
            handler.readBuf.clear();
            IoBuffer buf = IoBuffer.allocate(1);
            buf.put((byte) '.');
            buf.flip();
            session.write(buf).awaitUninterruptibly();

            //// Wait for StartTLS response.
            waitForResponse(handler, 1);
View Full Code Here

        WriteFuture writeFuture = null;
        for (int i = 0; i < COUNT; i++) {
            IoBuffer buf = IoBuffer.allocate(DATA_SIZE);
            buf.limit(DATA_SIZE);
            fillWriteBuffer(buf, i);
            buf.flip();

            writeFuture = session.write(buf);

            if (session.getService().getTransportMetadata().isConnectionless()) {
                // This will align message arrival order in connectionless transport types
View Full Code Here

            if (message instanceof IoBuffer) {
                IoBuffer rb = (IoBuffer) message;
                rb.mark();
                IoBuffer wb = IoBuffer.allocate(rb.remaining());
                wb.put(rb);
                wb.flip();
                rb.reset();
                messageCopy = wb;
            }
            return messageCopy;
        }
View Full Code Here

            if (step == SocksProxyConstants.SOCKS5_REQUEST_STEP) {
                buf = encodeProxyRequestPacket(request);
            }

            buf.flip();
            writeData(nextFilter, buf);

        } catch (Exception ex) {
            closeSession("Unable to send Socks request: ", ex);
        }
View Full Code Here

     * @return the new buffer, ready to read from
     */
    public static IoBuffer copy(ByteBuffer src) {
        IoBuffer copy = IoBuffer.allocate(src.remaining());
        copy.put(src);
        copy.flip();
        return copy;
    }
}
View Full Code Here

            throw new IllegalArgumentException(
                    "The encoded object is too big: " + objectSize + " (> "
                            + maxObjectSize + ')');
        }

        buf.flip();
        out.write(buf);
    }
}
View Full Code Here

                throws Exception {
            // Just echo the received bytes.
            IoBuffer rb = (IoBuffer) message;
            IoBuffer wb = IoBuffer.allocate(rb.remaining());
            wb.put(rb);
            wb.flip();
            session.write(wb);
        }
    }
}
View Full Code Here

        assertEquals(EnumSet.range(TestEnum.E1, TestEnum.E32), buf
                .getEnumSetInt(TestEnum.class));

        buf.clear();
        buf.putLong(-1L);
        buf.flip();
        assertEquals(EnumSet.allOf(TestEnum.class), buf
                .getEnumSetLong(TestEnum.class));

        // Test high bit set
        buf.clear();
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.