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 Details

    • streamHandler

      QuicConnection streamHandler(Handler<QuicStream> handler)
      Set a handler processing incoming Quic streams.
      Parameters:
      handler - the handler processing streams
      Returns:
      this instance of a connection
    • shutdownHandler

      QuicConnection shutdownHandler(Handler<Duration> handler)
      Set a handler notified when the connection is shutdown: the client or server will close the connection within a certain amount of time. This gives the opportunity to the handler to 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

      QuicConnection closeHandler(Handler<Void> handler)
      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

      default Future<QuicStream> openStream()
      Open a bidirectional stream to the remote endpoint.
      Returns:
      a Quic stream as a future
    • openStream

      Future<QuicStream> openStream(boolean bidirectional)
      Open a stream to the remote endpoint with bidirectional parameter specifying its directionality.
      Parameters:
      bidirectional - whether the stream is unidirectional or bidirectional
      Returns:
      A Quic stream as a future
    • datagramHandler

      QuicConnection datagramHandler(Handler<Buffer> handler)
      Set a handler called with the datagram addressed to this connection.
      Parameters:
      handler - the handler
      Returns:
      this instance of a connection
    • writeDatagram

      Future<Void> writeDatagram(Buffer buffer)
      Send a datagram.
      Parameters:
      buffer - the datagram
      Returns:
      a future signaling when the datagram has been written
    • close

      default Future<Void> close()
      Close the connection, all associated streams will be closed before.
      Returns:
      a future signaling the completion of the operation
    • close

      default Future<Void> close(QuicConnectionClose payload)
      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

      default Future<Void> shutdown()
      Shutdown with a 30 seconds timeout.
      Returns:
      a future completed when shutdown has completed
    • shutdown

      default Future<Void> shutdown(Duration timeout)
      Initiate a graceful connection shutdown, the connection is taken out of service and closed when all the inflight streams are processed, otherwise after a timeout the 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

      Future<Void> 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 a timeout the connection will be closed.
      Parameters:
      timeout - the amount of time after which all resources are forcibly closed
      payload - 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 0 when 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