Package io.netty.handler.codec.http2
Interface Http2Connection
- 
- All Known Implementing Classes:
- DefaultHttp2Connection
 
 public interface Http2ConnectionManager for the state of an HTTP/2 connection with the remote end-point.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceHttp2Connection.Endpoint<F extends Http2FlowController>A view of the connection from one endpoint (local or remote).static interfaceHttp2Connection.ListenerListener for life-cycle events for streams in this connection.static interfaceHttp2Connection.PropertyKeyA key to be used for associating application-defined properties with streams within this connection.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(Http2Connection.Listener listener)Adds a listener of stream life-cycle events.Future<java.lang.Void>close(Promise<java.lang.Void> promise)Close this connection.Http2StreamconnectionStream()Gets the stream object representing the connection, itself (i.e. stream zero).Http2StreamforEachActiveStream(Http2StreamVisitor visitor)Provide a means of iterating over the collection of active streams.booleangoAwayReceived()Indicates whether or not aGOAWAYwas received from the remote endpoint.voidgoAwayReceived(int lastKnownStream, long errorCode, ByteBuf message)Indicates that aGOAWAYwas received from the remote endpoint and sets the last known stream.booleangoAwaySent()Indicates whether or not aGOAWAYwas sent to the remote endpoint.booleangoAwaySent(int lastKnownStream, long errorCode, ByteBuf message)Updates the local state of thisHttp2Connectionas a result of aGOAWAYto send to the remote endpoint.booleanisServer()Indicates whether or not the local endpoint for this connection is the server.Http2Connection.Endpoint<Http2LocalFlowController>local()Gets a view of this connection from the localHttp2Connection.Endpoint.Http2Connection.PropertyKeynewKey()Creates a new key that is unique within thisHttp2Connection.intnumActiveStreams()Gets the number of streams that are actively in use (i.e.Http2Connection.Endpoint<Http2RemoteFlowController>remote()Gets a view of this connection from the remoteHttp2Connection.Endpoint.voidremoveListener(Http2Connection.Listener listener)Removes a listener of stream life-cycle events.Http2Streamstream(int streamId)Gets the stream if it exists.booleanstreamMayHaveExisted(int streamId)Indicates whether or not the given stream may have existed within this connection.
 
- 
- 
- 
Method Detail- 
closeFuture<java.lang.Void> close(Promise<java.lang.Void> promise) Close this connection. No more new streams can be created after this point and all streams that exists (active or otherwise) will be closed and removed.Note if iterating active streams via forEachActiveStream(Http2StreamVisitor)and an exception is thrown it is necessary to call this method again to ensure the close completes.- Parameters:
- promise- Will be completed when all streams have been removed, and listeners have been notified.
- Returns:
- A future that will be completed when all streams have been removed, and listeners have been notified.
 
 - 
newKeyHttp2Connection.PropertyKey newKey() Creates a new key that is unique within thisHttp2Connection.
 - 
addListenervoid addListener(Http2Connection.Listener listener) Adds a listener of stream life-cycle events.
 - 
removeListenervoid removeListener(Http2Connection.Listener listener) Removes a listener of stream life-cycle events. If the same listener was added multiple times then only the first occurrence gets removed.
 - 
streamHttp2Stream stream(int streamId) Gets the stream if it exists. If not, returnsnull.
 - 
streamMayHaveExistedboolean streamMayHaveExisted(int streamId) Indicates whether or not the given stream may have existed within this connection. This is a short form for callingHttp2Connection.Endpoint.mayHaveCreatedStream(int)on both endpoints.
 - 
connectionStreamHttp2Stream connectionStream() Gets the stream object representing the connection, itself (i.e. stream zero). This object always exists.
 - 
numActiveStreamsint numActiveStreams() Gets the number of streams that are actively in use (i.e.OPENorHALF CLOSED).
 - 
forEachActiveStreamHttp2Stream forEachActiveStream(Http2StreamVisitor visitor) throws Http2Exception Provide a means of iterating over the collection of active streams.- Parameters:
- visitor- The visitor which will visit each active stream.
- Returns:
- The stream before iteration stopped or nullif iteration went past the end.
- Throws:
- Http2Exception
 
 - 
isServerboolean isServer() Indicates whether or not the local endpoint for this connection is the server.
 - 
localHttp2Connection.Endpoint<Http2LocalFlowController> local() Gets a view of this connection from the localHttp2Connection.Endpoint.
 - 
remoteHttp2Connection.Endpoint<Http2RemoteFlowController> remote() Gets a view of this connection from the remoteHttp2Connection.Endpoint.
 - 
goAwayReceivedboolean goAwayReceived() Indicates whether or not aGOAWAYwas received from the remote endpoint.
 - 
goAwayReceivedvoid goAwayReceived(int lastKnownStream, long errorCode, ByteBuf message) throws Http2ExceptionIndicates that aGOAWAYwas received from the remote endpoint and sets the last known stream.- Parameters:
- lastKnownStream- The Last-Stream-ID in the GOAWAY frame.
- errorCode- the Error Code in the GOAWAY frame.
- message- The Additional Debug Data in the GOAWAY frame. Note that reference count ownership belongs to the caller (ownership is not transferred to this method).
- Throws:
- Http2Exception
 
 - 
goAwaySentboolean goAwaySent() Indicates whether or not aGOAWAYwas sent to the remote endpoint.
 - 
goAwaySentboolean goAwaySent(int lastKnownStream, long errorCode, ByteBuf message) throws Http2ExceptionUpdates the local state of thisHttp2Connectionas a result of aGOAWAYto send to the remote endpoint.- Parameters:
- lastKnownStream- The Last-Stream-ID in the GOAWAY frame.
- errorCode- the Error Code in the GOAWAY frame. GOAWAY frame. Note that reference count ownership belongs to the caller (ownership is not transferred to this method).
- Returns:
- trueif the corresponding- GOAWAYframe should be sent to the remote endpoint.
- Throws:
- Http2Exception
 
 
- 
 
-