public final class SpdyConnection extends Object implements Closeable
Many methods in this API are synchronous: the call is completed before the method returns. This is typical for Java but atypical for SPDY. This is motivated by exception transparency: an IOException that was triggered by a certain caller can be caught and handled by that caller.
Modifier and Type | Class and Description |
---|---|
static class |
SpdyConnection.Builder |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this connection.
|
void |
flush() |
long |
getIdleStartTimeNs()
Returns the time in ns when this connection became idle or 0L if connection is not idle.
|
boolean |
isIdle()
Returns true if this connection is idle.
|
SpdyStream |
newStream(List<String> requestHeaders,
boolean out,
boolean in)
Returns a new locally-initiated stream.
|
void |
noop()
Sends a noop frame to the peer.
|
int |
openStreamCount()
Returns the number of
open streams on this
connection. |
Ping |
ping()
Sends a ping frame to the peer.
|
void |
sendConnectionHeader()
Sends a connection header if the current variant requires it.
|
void |
shutdown(ErrorCode statusCode)
Degrades this connection such that new streams can neither be created
locally, nor accepted from the remote peer.
|
void |
writeData(int streamId,
boolean outFinished,
byte[] buffer,
int offset,
int byteCount) |
public int openStreamCount()
open streams
on this
connection.public boolean isIdle()
public long getIdleStartTimeNs()
public SpdyStream newStream(List<String> requestHeaders, boolean out, boolean in) throws IOException
out
- true to create an output stream that we can use to send data
to the remote peer. Corresponds to FLAG_FIN
.in
- true to create an input stream that the remote peer can use to
send data to us. Corresponds to FLAG_UNIDIRECTIONAL
.IOException
public void writeData(int streamId, boolean outFinished, byte[] buffer, int offset, int byteCount) throws IOException
IOException
public Ping ping() throws IOException
IOException
public void noop() throws IOException
IOException
public void flush() throws IOException
IOException
public void shutdown(ErrorCode statusCode) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void sendConnectionHeader()
SpdyConnection.Builder.build()
for all new connections.Copyright © 2014. All rights reserved.