public class DefaultHttp2Connection extends Object implements Http2Connection
Http2Connection.Http2Connection.Endpoint<F extends Http2FlowController>, Http2Connection.Listener, Http2Connection.PropertyKey| Constructor and Description |
|---|
DefaultHttp2Connection(boolean server)
Creates a new connection with the given settings.
|
DefaultHttp2Connection(boolean server,
int maxReservedStreams)
Creates a new connection with the given settings.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(Http2Connection.Listener listener)
Adds a listener of stream life-cycle events.
|
Future<Void> |
close(Promise<Void> promise)
Close this connection.
|
Http2Stream |
connectionStream()
Gets the stream object representing the connection, itself (i.e. stream zero).
|
Http2Stream |
forEachActiveStream(Http2StreamVisitor visitor)
Provide a means of iterating over the collection of active streams.
|
boolean |
goAwayReceived()
Indicates whether or not a
GOAWAY was received from the remote endpoint. |
void |
goAwayReceived(int lastKnownStream,
long errorCode,
ByteBuf debugData)
Indicates that a
GOAWAY was received from the remote endpoint and sets the last known stream. |
boolean |
goAwaySent()
Indicates whether or not a
GOAWAY was sent to the remote endpoint. |
boolean |
goAwaySent(int lastKnownStream,
long errorCode,
ByteBuf debugData)
Updates the local state of this
Http2Connection as a result of a GOAWAY to send to the remote
endpoint. |
boolean |
isServer()
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 local
Http2Connection.Endpoint. |
Http2Connection.PropertyKey |
newKey()
Creates a new key that is unique within this
Http2Connection. |
int |
numActiveStreams()
Gets the number of streams that are actively in use (i.e.
|
Http2Connection.Endpoint<Http2RemoteFlowController> |
remote()
Gets a view of this connection from the remote
Http2Connection.Endpoint. |
void |
removeListener(Http2Connection.Listener listener)
Removes a listener of stream life-cycle events.
|
Http2Stream |
stream(int streamId)
Gets the stream if it exists.
|
boolean |
streamMayHaveExisted(int streamId)
Indicates whether or not the given stream may have existed within this connection.
|
public DefaultHttp2Connection(boolean server)
server - whether or not this end-point is the server-side of the HTTP/2 connection.public DefaultHttp2Connection(boolean server,
int maxReservedStreams)
server - whether or not this end-point is the server-side of the HTTP/2 connection.maxReservedStreams - The maximum amount of streams which can exist in the reserved state for each endpoint.public Future<Void> close(Promise<Void> promise)
Http2ConnectionNote if iterating active streams via Http2Connection.forEachActiveStream(Http2StreamVisitor) and an exception is
thrown it is necessary to call this method again to ensure the close completes.
close in interface Http2Connectionpromise - Will be completed when all streams have been removed, and listeners have been notified.public void addListener(Http2Connection.Listener listener)
Http2ConnectionaddListener in interface Http2Connectionpublic void removeListener(Http2Connection.Listener listener)
Http2ConnectionremoveListener in interface Http2Connectionpublic boolean isServer()
Http2ConnectionisServer in interface Http2Connectionpublic Http2Stream connectionStream()
Http2ConnectionconnectionStream in interface Http2Connectionpublic Http2Stream stream(int streamId)
Http2Connectionnull.stream in interface Http2Connectionpublic boolean streamMayHaveExisted(int streamId)
Http2ConnectionHttp2Connection.Endpoint.mayHaveCreatedStream(int) on both endpoints.streamMayHaveExisted in interface Http2Connectionpublic int numActiveStreams()
Http2ConnectionOPEN or HALF CLOSED).numActiveStreams in interface Http2Connectionpublic Http2Stream forEachActiveStream(Http2StreamVisitor visitor) throws Http2Exception
Http2ConnectionforEachActiveStream in interface Http2Connectionvisitor - The visitor which will visit each active stream.null if iteration went past the end.Http2Exceptionpublic Http2Connection.Endpoint<Http2LocalFlowController> local()
Http2ConnectionHttp2Connection.Endpoint.local in interface Http2Connectionpublic Http2Connection.Endpoint<Http2RemoteFlowController> remote()
Http2ConnectionHttp2Connection.Endpoint.remote in interface Http2Connectionpublic boolean goAwayReceived()
Http2ConnectionGOAWAY was received from the remote endpoint.goAwayReceived in interface Http2Connectionpublic void goAwayReceived(int lastKnownStream,
long errorCode,
ByteBuf debugData)
throws Http2Exception
Http2ConnectionGOAWAY was received from the remote endpoint and sets the last known stream.goAwayReceived in interface Http2ConnectionlastKnownStream - The Last-Stream-ID in the
GOAWAY frame.errorCode - the Error Code in the
GOAWAY frame.debugData - The Additional Debug Data in the
GOAWAY frame. Note that reference count ownership
belongs to the caller (ownership is not transferred to this method).Http2Exceptionpublic boolean goAwaySent()
Http2ConnectionGOAWAY was sent to the remote endpoint.goAwaySent in interface Http2Connectionpublic boolean goAwaySent(int lastKnownStream,
long errorCode,
ByteBuf debugData)
throws Http2Exception
Http2ConnectionHttp2Connection as a result of a GOAWAY to send to the remote
endpoint.goAwaySent in interface Http2ConnectionlastKnownStream - 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).true if the corresponding GOAWAY frame should be sent to the remote endpoint.Http2Exceptionpublic Http2Connection.PropertyKey newKey()
Http2ConnectionHttp2Connection.newKey in interface Http2ConnectionCopyright © 2008–2025 The Netty Project. All rights reserved.