public class

SSLIOSession

extends Object
implements IOSession SessionBufferStatus
java.lang.Object
   ↳ org.apache.http.impl.nio.reactor.SSLIOSession

Class Overview

A decorator class intended to transparently extend an IOSession with transport layer security capabilities based on the SSL/TLS protocol.

Summary

[Expand]
Inherited Constants
From interface org.apache.http.nio.reactor.IOSession
Public Constructors
SSLIOSession(IOSession session, SSLContext sslContext, SSLSetupHandler handler)
SSLIOSession(IOSession session, SSLContext sslContext, SSLIOSessionHandler handler)
This constructor is deprecated. No replacement.
Public Methods
synchronized void bind(SSLMode mode, HttpParams params)
ByteChannel channel()
Returns the underlying I/O channel associated with this session.
synchronized void clearEvent(int op)
Clears interest in a particular I/O event type by updating the event mask associated with the session.
void close()
Terminates the session gracefully and closes the underlying I/O channel.
Object getAttribute(String name)
Returns the value of the attribute with the given name.
synchronized int getEventMask()
Returns mask of I/O evens this session declared interest in.
SocketAddress getLocalAddress()
Returns local address.
SocketAddress getRemoteAddress()
Returns address of the remote peer.
int getSocketTimeout()
Returns value of the socket timeout in milliseconds.
int getStatus()
Returns status of the session:

ACTIVE: session is active.

synchronized boolean hasBufferedInput()
Determines if the input buffer associated with the session contains data.
synchronized boolean hasBufferedOutput()
Determines if the output buffer associated with the session contains data.
synchronized void inboundTransport()
synchronized boolean isAppInputReady()
synchronized boolean isAppOutputReady()
boolean isClosed()
Determines if the session has been terminated.
synchronized boolean isInboundDone()
synchronized boolean isOutboundDone()
synchronized void outboundTransport()
Object removeAttribute(String name)
Removes attribute with the given name.
void setAttribute(String name, Object obj)
This method can be used to associate a particular object with the session by the given attribute name.
synchronized void setBufferStatus(SessionBufferStatus status)
Quite often I/O sessions need to maintain internal I/O buffers in order to transform input / output data prior to returning it to the consumer or writing it to the underlying channel.
synchronized void setEvent(int op)
Declares interest in a particular I/O event type by updating the event mask associated with the session.
synchronized void setEventMask(int ops)
Declares interest in I/O event notifications by setting the event mask associated with the session
void setSocketTimeout(int timeout)
Sets value of the socket timeout in milliseconds.
void shutdown()
Terminates the session by shutting down the underlying I/O channel.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.nio.reactor.IOSession
From interface org.apache.http.nio.reactor.SessionBufferStatus

Public Constructors

public SSLIOSession (IOSession session, SSLContext sslContext, SSLSetupHandler handler)

public SSLIOSession (IOSession session, SSLContext sslContext, SSLIOSessionHandler handler)

This constructor is deprecated.
No replacement.

Public Methods

public synchronized void bind (SSLMode mode, HttpParams params)

Throws
SSLException

public ByteChannel channel ()

Returns the underlying I/O channel associated with this session.

Returns
  • the I/O channel.

public synchronized void clearEvent (int op)

Clears interest in a particular I/O event type by updating the event mask associated with the session.

Parameters
op I/O event type.

public void close ()

Terminates the session gracefully and closes the underlying I/O channel. This method ensures that session termination handshake, such as the one used by the SSL/TLS protocol, is correctly carried out.

public Object getAttribute (String name)

Returns the value of the attribute with the given name. The value can be null if not set.

The value of the session attachment object can be obtained using ATTACHMENT_KEY name.

Parameters
name name of the attribute.
Returns
  • value of the attribute.

public synchronized int getEventMask ()

Returns mask of I/O evens this session declared interest in.

Returns
  • I/O event mask.

public SocketAddress getLocalAddress ()

Returns local address.

Returns
  • socket address.

public SocketAddress getRemoteAddress ()

Returns address of the remote peer.

Returns
  • socket address.

public int getSocketTimeout ()

Returns value of the socket timeout in milliseconds. The value of 0 signifies the session cannot time out.

Returns
  • socket timeout.

public int getStatus ()

Returns status of the session:

ACTIVE: session is active.

CLOSING: session is being closed.

CLOSED: session has been terminated.

Returns
  • session status.

public synchronized boolean hasBufferedInput ()

Determines if the input buffer associated with the session contains data.

Returns
  • true if the session input buffer contains data, false otherwise.

public synchronized boolean hasBufferedOutput ()

Determines if the output buffer associated with the session contains data.

Returns
  • true if the session output buffer contains data, false otherwise.

public synchronized void inboundTransport ()

Throws
IOException - not thrown currently

public synchronized boolean isAppInputReady ()

Throws
IOException

public synchronized boolean isAppOutputReady ()

Throws
IOException - not thrown currently

public boolean isClosed ()

Determines if the session has been terminated.

Returns
  • true if the session has been terminated, false otherwise.

public synchronized boolean isInboundDone ()

public synchronized boolean isOutboundDone ()

public synchronized void outboundTransport ()

Throws
IOException

public Object removeAttribute (String name)

Removes attribute with the given name.

Parameters
name name of the attribute to be removed.
Returns
  • value of the removed attribute.

public void setAttribute (String name, Object obj)

This method can be used to associate a particular object with the session by the given attribute name.

I/O sessions are not bound to an execution thread, therefore one cannot use the context of the thread to store a session's state. All details about a particular session must be stored within the session itself.

Parameters
name name of the attribute.
obj value of the attribute.

public synchronized void setBufferStatus (SessionBufferStatus status)

Quite often I/O sessions need to maintain internal I/O buffers in order to transform input / output data prior to returning it to the consumer or writing it to the underlying channel. Memory management in HttpCore NIO is based on the fundamental principle that the data consumer can read only as much input data as it can process without having to allocate more memory. That means, quite often some input data may remain unread in one of the internal or external session buffers. The I/O reactor can query the status of these session buffers, and make sure the consumer gets notified correctly as more data gets stored in one of the session buffers, thus allowing the consumer to read the remaining data once it is able to process it

I/O sessions can be made aware of the status of external session buffers using the SessionBufferStatus interface.

public synchronized void setEvent (int op)

Declares interest in a particular I/O event type by updating the event mask associated with the session.

Parameters
op I/O event type.

public synchronized void setEventMask (int ops)

Declares interest in I/O event notifications by setting the event mask associated with the session

Parameters
ops new I/O event mask.

public void setSocketTimeout (int timeout)

Sets value of the socket timeout in milliseconds. The value of 0 signifies the session cannot time out.

Parameters
timeout socket timeout.

public void shutdown ()

Terminates the session by shutting down the underlying I/O channel.

public String toString ()