@UnstableApi public class DefaultHttp2Connection extends java.lang.Object implements Http2Connection
Http2Connection
.Http2Connection.Endpoint<F extends Http2FlowController>, Http2Connection.Listener, Http2Connection.PropertyKey
构造器和说明 |
---|
DefaultHttp2Connection(boolean server)
Creates a new connection with the given settings.
|
DefaultHttp2Connection(boolean server,
int maxReservedStreams)
Creates a new connection with the given settings.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addListener(Http2Connection.Listener listener)
Adds a listener of stream life-cycle events.
|
Future<java.lang.Void> |
close(Promise<java.lang.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<java.lang.Void> close(Promise<java.lang.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
在接口中 Http2Connection
promise
- Will be completed when all streams have been removed, and listeners have been notified.public void addListener(Http2Connection.Listener listener)
Http2Connection
addListener
在接口中 Http2Connection
public void removeListener(Http2Connection.Listener listener)
Http2Connection
removeListener
在接口中 Http2Connection
public boolean isServer()
Http2Connection
isServer
在接口中 Http2Connection
public Http2Stream connectionStream()
Http2Connection
connectionStream
在接口中 Http2Connection
public Http2Stream stream(int streamId)
Http2Connection
null
.stream
在接口中 Http2Connection
public boolean streamMayHaveExisted(int streamId)
Http2Connection
Http2Connection.Endpoint.mayHaveCreatedStream(int)
on both endpoints.streamMayHaveExisted
在接口中 Http2Connection
public int numActiveStreams()
Http2Connection
OPEN
or HALF CLOSED
).numActiveStreams
在接口中 Http2Connection
public Http2Stream forEachActiveStream(Http2StreamVisitor visitor) throws Http2Exception
Http2Connection
forEachActiveStream
在接口中 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
在接口中 Http2Connection
public Http2Connection.Endpoint<Http2RemoteFlowController> remote()
Http2Connection
Http2Connection.Endpoint
.remote
在接口中 Http2Connection
public boolean goAwayReceived()
Http2Connection
GOAWAY
was received from the remote endpoint.goAwayReceived
在接口中 Http2Connection
public void goAwayReceived(int lastKnownStream, long errorCode, ByteBuf debugData) throws Http2Exception
Http2Connection
GOAWAY
was received from the remote endpoint and sets the last known stream.goAwayReceived
在接口中 Http2Connection
lastKnownStream
- 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).Http2Exception
public boolean goAwaySent()
Http2Connection
GOAWAY
was sent to the remote endpoint.goAwaySent
在接口中 Http2Connection
public boolean goAwaySent(int lastKnownStream, long errorCode, ByteBuf debugData) throws Http2Exception
Http2Connection
Http2Connection
as a result of a GOAWAY
to send to the remote
endpoint.goAwaySent
在接口中 Http2Connection
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).true
if the corresponding GOAWAY
frame should be sent to the remote endpoint.Http2Exception
public Http2Connection.PropertyKey newKey()
Http2Connection
Http2Connection
.newKey
在接口中 Http2Connection