Interface QuicConnection
public interface QuicConnection
A Quic connection between a client and a server, providing support for handling or creating Quic streams
- Author:
- Julien Viet
-
Method Summary
Modifier and TypeMethodDescriptionclose()Close the connection, all associated streams will be closed before.close(QuicConnectionClose payload) Close the connection, all associated streams will be closed before.closeHandler(Handler<Void> handler) Set a handler called when the connection is closed.datagramHandler(Handler<Buffer> handler) Set a handler called with the datagram addressed to this connection.intdefault Future<QuicStream> Open a bidirectional stream to the remote endpoint.openStream(boolean bidirectional) Open a stream to the remote endpoint withbidirectional parameterspecifying its directionality.shutdown()Shutdown with a 30 seconds timeout.Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight streams are processed, otherwise after atimeoutthe connection will be closed.shutdown(Duration timeout, QuicConnectionClose payload) Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight streams are processed, otherwise after atimeoutthe connection will be closed.shutdownHandler(Handler<Duration> handler) Set ahandlernotified when the connection is shutdown: the client or server will close the connection within a certain amount of time.streamHandler(Handler<QuicStream> handler) Set a handler processing incoming Quic streams.writeDatagram(Buffer buffer) Send a datagram.
-
Method Details
-
streamHandler
Set a handler processing incoming Quic streams.- Parameters:
handler- the handler processing streams- Returns:
- this instance of a connection
-
shutdownHandler
Set ahandlernotified when the connection is shutdown: the client or server will close the connection within a certain amount of time. This gives the opportunity to thehandlerto close the connection gracefully before the socket is closed.- Parameters:
handler- the handler notified- Returns:
- a reference to this, so the API can be used fluently
-
closeHandler
Set a handler called when the connection is closed.- Parameters:
handler- the handler signaled with the connection close- Returns:
- this instance of a connection
-
openStream
Open a bidirectional stream to the remote endpoint.- Returns:
- a Quic stream as a future
-
openStream
Open a stream to the remote endpoint withbidirectional parameterspecifying its directionality.- Parameters:
bidirectional- whether the stream is unidirectional or bidirectional- Returns:
- A Quic stream as a future
-
datagramHandler
Set a handler called with the datagram addressed to this connection.- Parameters:
handler- the handler- Returns:
- this instance of a connection
-
writeDatagram
-
close
-
close
Close the connection, all associated streams will be closed before.- Parameters:
payload- the close payload- Returns:
- a future signaling the completion of the operation
-
shutdown
-
shutdown
Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight streams are processed, otherwise after atimeoutthe connection will be closed.- Parameters:
timeout- the amount of time after which all resources are forcibly closed- Returns:
- a future completed when shutdown has completed
-
shutdown
Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight streams are processed, otherwise after atimeoutthe connection will be closed.- Parameters:
timeout- the amount of time after which all resources are forcibly closedpayload- the close payload- Returns:
- a future completed when shutdown has completed
-
applicationLayerProtocol
String applicationLayerProtocol()- Returns:
- the application-level protocol negotiated during the TLS handshake
-
indicatedServerName
String indicatedServerName()- Returns:
- the server name indicated during the TLS handshake
-
transportParams
QuicTransportParams transportParams()- Returns:
- the transport parameters
-
maxDatagramLength
int maxDatagramLength()- Returns:
- the maximum number of bytes the datagram payload can be or
0when the datagram extension is disabled
-
sslSession
SSLSession sslSession()- Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
- See Also:
-
closePayload
QuicConnectionClose closePayload()- Returns:
- the close payload, available after the close handler is signaled
-
remoteAddress
SocketAddress remoteAddress()- Returns:
- the remote connection socket address
-
localAddress
SocketAddress localAddress()- Returns:
- the local connection socket address
-