Class QuicheSession
- All Implemented Interfaces:
 Session, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle
Represents a logical connection with a remote peer, identified by a QUIC connection id.
Bytes received from a QuicheConnection in feed(SocketAddress, ByteBuffer)
are passed to Quiche for processing; in turn, Quiche produces a list of QUIC stream ids that
have pending I/O events, either read-ready or write-ready.
On the receive side, a QuicheSession fans-out to multiple QuicheStreams.
On the send side, many QuicheStreams fan-in to a QuicheSession.
- See Also:
 
- 
Nested Class Summary
Nested classes/interfaces inherited from class AbstractSession
AbstractSession.ListenerNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Container
Container.InheritedListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainer, Dumpable.DumpAppendable - 
Field Summary
 - 
Constructor Summary
ConstructorsConstructorDescriptionQuicheSession(Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, QuicConfiguration configuration, Quiche quiche, QuicheConnection connection, SocketAddress localAddress, SocketAddress remoteAddress, Session.Listener listener)  - 
Method Summary
Modifier and TypeMethodDescriptionprotected intdata(QuicheStream stream, boolean last, ByteBuffer buffer) voiddisconnect(ConnectionCloseFrame frame, Throwable failure, Promise.Invocable<Session> promise) Disconnects this session, with the givenCONNECTION_CLOSEand failure cause, if any.voiddispatch()voidfeed(SocketAddress remoteAddress, ByteBuffer cipherBuffer) voidflush()protected QuicheConnectiongetId()longlongReturns the peer certificates chain.getStream(long streamId) booleanbooleanisOpen()voidmaxData(MaxDataFrame frame, Promise.Invocable<Session> promise) Sends a MAX_DATA frame on this connection.voidmaxStreams(MaxStreamsFrame frame, Promise.Invocable<Session> promise) Sends a MAX_STREAMS frame on this connection.newStream(long streamId, Stream.Listener listener) Creates a new local QUIC stream with the given stream id and listener.voidbooleanonIdleTimeout(TimeoutException timeout) voidopen()voidping(Promise.Invocable<Session> promise) Sends a PING frame on this connection.voidproduce()voidsetConnectionId(QuicheConnectionId connectionId) voidsetIdleTimeout(long idleTimeout) Methods inherited from class AbstractSession
close, emitDisconnect, emitOpen, getExecutor, getListener, getQuicConfiguration, notifyClose, notifyDataBlocked, notifyDisconnect, notifyIdleTimeout, notifyLocalClose, notifyMaxData, notifyMaxStreams, notifyNewStream, notifyOpen, notifyPing, notifyPrepare, notifyStreamsBlocked, notifyTransportParameters, shutdown, toStringMethods inherited from class ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, doStop, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Container
getCachedBeans, getEventListenersMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface Session
newStreamId 
- 
Constructor Details
- 
QuicheSession
public QuicheSession(Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, QuicConfiguration configuration, Quiche quiche, QuicheConnection connection, SocketAddress localAddress, SocketAddress remoteAddress, Session.Listener listener)  
 - 
 - 
Method Details
- 
getScheduler
 - 
getByteBufferPool
 - 
getConnection
 - 
getNegotiatedProtocol
 - 
getId
- Returns:
 - the QUIC connection id
 
 - 
newStream
Description copied from interface:SessionCreates a new local QUIC stream with the given stream id and listener.
- Parameters:
 streamId- the QUIC stream idlistener- the listener of stream events- Returns:
 - a new local QUIC stream
 
 - 
getStream
- Parameters:
 streamId- the stream id- Returns:
 - the QUIC stream with the given stream id
 
 - 
getStreams
- Returns:
 - the QUIC streams managed by this session
 
 - 
maxStreams
Description copied from interface:SessionSends a MAX_STREAMS frame on this connection.
- Parameters:
 frame- the frame to sendpromise- thePromise.Invocablethat gets notified when the frame has been sent
 - 
ping
Description copied from interface:SessionSends a PING frame on this connection.
- Parameters:
 promise- thePromise.Invocablethat gets notified when the frame has been sent
 - 
maxData
Description copied from interface:SessionSends a MAX_DATA frame on this connection.
- Parameters:
 frame- the frame to sendpromise- thePromise.Invocablethat gets notified when the frame has been sent
 - 
disconnect
public void disconnect(ConnectionCloseFrame frame, Throwable failure, Promise.Invocable<Session> promise) Description copied from interface:SessionDisconnects this session, with the given
CONNECTION_CLOSEand failure cause, if any.Differently from
Session.close(ConnectionCloseFrame, Promise.Invocable), this method performs disconnect actions outwards, towards the network: typically clean-up actions and eventually sends the given QUIC close frame and finally disconnect at the network level, if necessary.- Parameters:
 frame- the frame carrying the error code and reasonfailure- the failure that caused the disconnect, ornullpromise- thePromise.Invocablethat gets notified when the disconnect is complete
 - 
getLocalSocketAddress
- Returns:
 - the local 
SocketAddressassociated with this session 
 - 
getRemoteSocketAddress
- Returns:
 - the remote 
SocketAddressassociated with this session 
 - 
getLocalBidirectionalMaxStreams
public long getLocalBidirectionalMaxStreams()- Returns:
 - the local bidirectional streams max count
 
 - 
getIdleTimeout
public long getIdleTimeout()- Returns:
 - the idle timeout in milliseconds
 
 - 
setIdleTimeout
public void setIdleTimeout(long idleTimeout)  - 
onIdleTimeout
 - 
getConnectionId
 - 
setConnectionId
 - 
feed
- Throws:
 IOException
 - 
isConnectionEstablished
public boolean isConnectionEstablished() - 
getPeerCertificates
Returns the peer certificates chain.
Due to current Quiche C API limitations (that the Rust version does not have), only the last certificate in the chain is returned. This may change in the future when the C APIs are aligned to the Rust APIs.
- Specified by:
 getPeerCertificatesin classAbstractSession- Returns:
 - the peer certificates chain (currently only the last certificate in the chain)
 
 - 
produce
public void produce() - 
dispatch
public void dispatch() - 
data
- Throws:
 IOException
 - 
offerTask
- Specified by:
 offerTaskin classAbstractSession- Parameters:
 task- The task to offer to the execution strategy.dispatch-trueto dispatch the task,falseto produce in the calling thread. Callers from application threads should usetrue, otherwise they may be arbitrarily delayed. Callers from I/O threads should usefalseto avoid thread hops.
 - 
flush
public void flush() - 
isOpen
public boolean isOpen() - 
open
public void open() 
 -