public class DefaultHttp2Connection extends Object implements Http2Connection
Http2Connection
.Http2Connection.Endpoint<F extends Http2FlowController>, Http2Connection.Listener
Constructor and Description |
---|
DefaultHttp2Connection(boolean server)
Creates a connection with an immediate stream removal policy.
|
DefaultHttp2Connection(boolean server,
Http2StreamRemovalPolicy removalPolicy)
Creates a new connection with the given settings.
|
Modifier and Type | Method and Description |
---|---|
Set<Http2Stream> |
activeStreams()
Gets all streams that are actively in use.
|
void |
addListener(Http2Connection.Listener listener)
Adds a listener of stream life-cycle events.
|
Http2Stream |
connectionStream()
Gets the stream object representing the connection, itself (i.e. stream zero).
|
Http2Stream |
createLocalStream(int streamId)
Creates a new stream initiated by the local endpoint
|
Http2Stream |
createRemoteStream(int streamId)
Creates a new stream initiated by the remote endpoint.
|
void |
deactivate(Http2Stream stream)
Indicates that the given stream is no longer actively in use.
|
boolean |
goAwayReceived()
Indicates whether or not a
GOAWAY was received from the remote endpoint. |
void |
goAwayReceived(int lastKnownStream)
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)
Indicates that a
GOAWAY was sent to the remote endpoint and sets the last known stream. |
boolean |
isGoAway()
Indicates whether or not either endpoint has received a GOAWAY.
|
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 . |
int |
numActiveStreams()
Gets the number of streams that actively in use.
|
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 |
requireStream(int streamId)
Attempts to get the stream for the given ID.
|
Http2Stream |
stream(int streamId)
Gets the stream if it exists.
|
public DefaultHttp2Connection(boolean server)
server
- whether or not this end-point is the server-side of the HTTP/2 connection.public DefaultHttp2Connection(boolean server, Http2StreamRemovalPolicy removalPolicy)
server
- whether or not this end-point is the server-side of the HTTP/2 connection.removalPolicy
- the policy to be used for removal of closed stream.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 requireStream(int streamId) throws Http2Exception
Http2Connection
requireStream
in interface Http2Connection
Http2Exception
public Http2Stream stream(int streamId)
Http2Connection
null
.stream
in interface Http2Connection
public int numActiveStreams()
Http2Connection
numActiveStreams
in interface Http2Connection
public Set<Http2Stream> activeStreams()
Http2Connection
activeStreams
in interface Http2Connection
public void deactivate(Http2Stream stream)
Http2Connection
Http2Connection.activeStreams()
and Http2Connection.numActiveStreams()
will be decremented. In addition,
all listeners will be notified of this event via
Http2Connection.Listener.streamInactive(Http2Stream)
.deactivate
in interface Http2Connection
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 isGoAway()
Http2Connection
isGoAway
in interface Http2Connection
public Http2Stream createLocalStream(int streamId) throws Http2Exception
Http2Connection
createLocalStream
in interface Http2Connection
Http2Exception
Http2Connection.Endpoint.createStream(int)
public Http2Stream createRemoteStream(int streamId) throws Http2Exception
Http2Connection
createRemoteStream
in interface Http2Connection
Http2Exception
Http2Connection.Endpoint.createStream(int)
public boolean goAwayReceived()
Http2Connection
GOAWAY
was received from the remote endpoint.goAwayReceived
in interface Http2Connection
public void goAwayReceived(int lastKnownStream)
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)
Http2Connection
GOAWAY
was sent to the remote endpoint and sets the last known stream.goAwaySent
in interface Http2Connection
Copyright © 2008–2015 The Netty Project. All rights reserved.