/** * This returns the socket channel for the connected pipeline. It * is this channel that is used to determine if there are bytes * that can be written. When closed this is no longer selectable. * * @return this returns the connected channel for the pipeline */ public SocketChannel getChannel() { return socket.getChannel(); }
/** * This method is used to acquire the <code>SocketChannel</code> * for the connection. This allows the server to acquire the input * and output streams with which to communicate. It can also be * used to configure the connection and perform various network * operations that could otherwise not be performed. * * @return this returns the socket used by this HTTP pipeline */ public SocketChannel getChannel() { return socket.getChannel(); }
/** * This method is used to acquire the <code>SocketChannel</code> * for the connection. This allows the server to acquire the input * and output streams with which to communicate. It can also be * used to configure the connection and perform various network * operations that could otherwise not be performed. * * @return this returns the socket used by this HTTP pipeline */ public SocketChannel getChannel() { return socket.getChannel(); }
/** * This method is used to acquire the <code>SocketChannel</code> * for the connection. This allows the server to acquire the input * and output streams with which to communicate. It can also be * used to configure the connection and perform various network * operations that could otherwise not be performed. * * @return this returns the socket used by this HTTP pipeline */ public SocketChannel getChannel() { return socket.getChannel(); }
/** * This returns the socket channel for the connected pipeline. It * is this channel that is used to determine if there are bytes * that can be written. When closed this is no longer selectable. * * @return this returns the connected channel for the pipeline */ public SocketChannel getChannel() { return socket.getChannel(); }
public void process( Socket pipeline ) throws IOException { final SocketChannel channel = pipeline.getChannel(); final Map map = new HashMap(); Socket secure = new Socket() { private SSLEngine engine; public Map getAttributes() { return map; } public SocketChannel getChannel() { return channel; } public SSLEngine getEngine() { if( engine == null ) { engine = context.createSSLEngine(); } return engine; } }; processor.process( secure ); }
@SuppressWarnings({"rawtypes", "unchecked"}) public void process(Socket socket) throws IOException { Map atts = socket.getAttributes(); SocketChannel channel = socket.getChannel(); atts.put("fixd-socket", channel); server.process(socket); }
/** * Constructor for the <code>SocketWriter</code> object. This * is used to wrap the socket in an object that will queue and * coalesce the packets written. It ensures that the packets * that are sent are of a minimum size for performance. * * @param socket this is the pipeline instance this wraps * @param limit this is the threshold for asynchronous buffers */ public SocketWriter(Socket socket, int limit) { this.compacter = new BufferCompacter(limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); }
/** * Constructor for the <code>SocketBuffer</code> object. This is * used to create a buffer that will collect small fragments sent * in to a more reasonably sized packet. * * @param socket this is the socket to write the data to * @param chunk this is the minimum packet size to used * @param limit this is the maximum size of the output buffer */ public SocketBuffer(Socket socket, int chunk, int limit) { this.appender = new SocketBufferAppender(socket, chunk, limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.chunk = chunk; }
/** * Constructor for the <code>SocketBuffer</code> object. This is * used to create a buffer that will collect small fragments sent * in to a more reasonably sized packet. * * @param socket this is the socket to write the data to * @param chunk this is the minimum packet size to used * @param limit this is the maximum size of the output buffer */ public SocketBuffer(Socket socket, int chunk, int limit) { this.appender = new SocketBufferAppender(socket, chunk, limit); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.chunk = chunk; }
/** * Pass in the connection socket and add the engine to the pipeline * attributes. * * @param socket * the pipeline */ @SuppressWarnings("unchecked") public void process(Socket socket) throws IOException { final Map map = socket.getAttributes(); final SSLEngine engine = socket.getEngine(); final SocketChannel channel = socket.getChannel(); map.put(PROPERTY_ENGINE, engine); map.put(PROPERTY_SOCKET, channel); server.process(socket); }
/** * Constructor for the <code>SocketTransport</code> object. This * requires a reactor to perform asynchronous writes and also the * pipeline which is used to read and write data. This transport * will use a queue of buffers which are lazily initialized so as * to only allocate the memory on demand. * * @param socket this is used to read and write the data * @param reactor this is used to perform asynchronous writes * @param buffer this is the size of the output buffer to use * @param threshold this is the maximum size of the output buffer */ public SocketTransport(Socket socket, Reactor reactor, int buffer, int threshold) throws IOException { this.writer = new SocketBufferWriter(socket, reactor, buffer, threshold); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.socket = socket; }
/** * Constructor for the <code>SocketTransport</code> object. This * requires a reactor to perform asynchronous writes and also the * pipeline which is used to read and write data. This transport * will use a queue of buffers which are lazily initialized so as * to only allocate the memory on demand. * * @param socket this is used to read and write the data * @param reactor this is used to perform asynchronous writes * @param buffer this is the size of the output buffer to use * @param threshold this is the maximum size of the output buffer */ public SocketTransport(Socket socket, Reactor reactor, int buffer, int threshold) throws IOException { this.writer = new SocketBufferWriter(socket, reactor, buffer, threshold); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.socket = socket; }
/** * Constructor for the <code>SocketTransport</code> object. This * requires a reactor to perform asynchronous writes and also the * pipeline which is used to read and write data. This transport * will use a queue of buffers which are lazily initialized so as * to only allocate the memory on demand. * * @param socket this is used to read and write the data * @param reactor this is used to perform asynchronous writes * @param threshold this is the threshold for asynchronous buffers * @param queue this is the queue size for asynchronous writes * @param buffer this is the size of the buffers to be used */ public SocketTransport(Socket socket, Reactor reactor, int threshold, int queue, int buffer) throws IOException { this.writer = new SocketController(socket, reactor, threshold); this.builder = new PacketBuilder(queue, buffer); this.channel = socket.getChannel(); this.trace = socket.getTrace(); this.socket = socket; }