@UnstableApi 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. |
void |
goAwaySent(int lastKnownStream,
long errorCode,
ByteBuf debugData)
Indicates that a
GOAWAY was sent to the remote endpoint and sets the last known stream. |
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)
Http2Connection
Note 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 Http2Connection
promise
- Will be completed when all streams have been removed, and listeners have been notified.public void addListener(Http2Connection.Listener listener)
Http2Connection
addListener
in interface Http2Connection
public void removeListener(Http2Connection.Listener listener)
Http2Connection
removeListener
in interface Http2Connection
public boolean isServer()
Http2Connection
isServer
in interface Http2Connection
public Http2Stream connectionStream()
Http2Connection
connectionStream
in interface Http2Connection
public Http2Stream stream(int streamId)
Http2Connection
null
.stream
in interface Http2Connection
public boolean streamMayHaveExisted(int streamId)
Http2Connection
Http2Connection.Endpoint.mayHaveCreatedStream(int)
on both endpoints.streamMayHaveExisted
in interface Http2Connection
public int numActiveStreams()
Http2Connection
OPEN
or HALF CLOSED
).numActiveStreams
in interface Http2Connection
public Http2Stream forEachActiveStream(Http2StreamVisitor visitor) throws Http2Exception
Http2Connection
forEachActiveStream
in interface Http2Connection
visitor
- The visitor which will visit each active stream.null
if iteration went past the end.Http2Exception
public Http2Connection.Endpoint<Http2LocalFlowController> local()
Http2Connection
Http2Connection.Endpoint
.local
in interface Http2Connection
public Http2Connection.Endpoint<Http2RemoteFlowController> remote()
Http2Connection
Http2Connection.Endpoint
.remote
in interface Http2Connection
public boolean goAwayReceived()
Http2Connection
GOAWAY
was received from the remote endpoint.goAwayReceived
in interface Http2Connection
public void goAwayReceived(int lastKnownStream, long errorCode, ByteBuf debugData)
Http2Connection
GOAWAY
was received from the remote endpoint and sets the last known stream.goAwayReceived
in interface Http2Connection
public boolean goAwaySent()
Http2Connection
GOAWAY
was sent to the remote endpoint.goAwaySent
in interface Http2Connection
public void goAwaySent(int lastKnownStream, long errorCode, ByteBuf debugData)
Http2Connection
GOAWAY
was sent to the remote endpoint and sets the last known stream.goAwaySent
in interface Http2Connection
public Http2Connection.PropertyKey newKey()
Http2Connection
Http2Connection
.newKey
in interface Http2Connection
Copyright © 2008–2017 The Netty Project. All rights reserved.