public final class RealConnection extends Http2Connection.Listener implements Connection
| Modifier and Type | Field and Description |
|---|---|
int |
allocationLimit
此连接可承载的并发流的最大数目如果
allocations.size() < allocationLimit
则可以在此连接上创建新的流 |
List<Reference<StreamAllocation>> |
allocations
由该连接传送的当前流.
|
long |
idleAtNanos
当
allocations.size()达到0时的Nanotime时间戳 |
boolean |
noNewStreams
如果为真,则不能在此连接上创建新的流
|
int |
successCount |
REFUSE_INCOMING_STREAMS| Constructor and Description |
|---|
RealConnection(ConnectionPool connectionPool,
Route route) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
void |
connect(int connectTimeout,
int readTimeout,
int writeTimeout,
int pingIntervalMillis,
boolean connectionRetryEnabled,
NewCall call,
EventListener eventListener) |
Handshake |
handshake() |
boolean |
isEligible(Address address,
Route route)
如果此连接可以将流分配到
address,则返回true。如果非空route是连接的解析路由 |
boolean |
isHealthy(boolean doExtensiveChecks)
如果此连接准备托管新流,则返回true
|
boolean |
isMultiplexed() |
HttpCodec |
newCodec(Httpd client,
Interceptor.Chain chain,
StreamAllocation streamAllocation) |
RealWebSocket.Streams |
newWebSocketStreams(StreamAllocation streamAllocation) |
void |
onSettings(Http2Connection connection)
通知连接的对等点的设置可能已更改。实现应该采取适当的操作来处理更新的设置
处理对该方法的并发调用是实现的职责。发送多个设置帧的远程对等点将触发对该
方法的多个调用,而这些调用不一定是序列化的
|
void |
onStream(Http2Stream stream)
处理来自此连接的对等点的新流。实现应该通过响应流或
closing it。这个响应不需要是同步的
|
Protocol |
protocol() |
Route |
route() |
Socket |
socket() |
boolean |
supportsUrl(UnoUrl url) |
static RealConnection |
testConnection(ConnectionPool connectionPool,
Route route,
Socket socket,
long idleAtNanos) |
String |
toString() |
public final List<Reference<StreamAllocation>> allocations
public boolean noNewStreams
public int successCount
public int allocationLimit
allocations.size() < allocationLimit
则可以在此连接上创建新的流public long idleAtNanos
allocations.size()达到0时的Nanotime时间戳public RealConnection(ConnectionPool connectionPool, Route route)
public static RealConnection testConnection(ConnectionPool connectionPool, Route route, Socket socket, long idleAtNanos)
public void connect(int connectTimeout,
int readTimeout,
int writeTimeout,
int pingIntervalMillis,
boolean connectionRetryEnabled,
NewCall call,
EventListener eventListener)
public boolean isEligible(Address address, Route route)
address,则返回true。如果非空route是连接的解析路由address - 地址信息route - 路由public boolean supportsUrl(UnoUrl url)
public HttpCodec newCodec(Httpd client, Interceptor.Chain chain, StreamAllocation streamAllocation) throws SocketException
SocketExceptionpublic RealWebSocket.Streams newWebSocketStreams(StreamAllocation streamAllocation)
public Route route()
route in interface Connectionpublic void cancel()
public Socket socket()
socket in interface Connectionpublic boolean isHealthy(boolean doExtensiveChecks)
doExtensiveChecks - 是否检查public void onStream(Http2Stream stream) throws IOException
Http2Connection.ListeneronStream in class Http2Connection.Listenerstream - 响应流IOException - 异常public void onSettings(Http2Connection connection)
Http2Connection.ListeneronSettings in class Http2Connection.Listenerconnection - 连接信息public Handshake handshake()
handshake in interface Connectionpublic boolean isMultiplexed()
public Protocol protocol()
protocol in interface Connection#HTTP_1_1。
此方法返回Protocol.HTTP_1_1,即使远程对等方使用Protocol.HTTP_1_0Copyright © 2020. All rights reserved.