public abstract class QuicClient extends Transport<T,CONF>
connect()
is ultimately called.
Example:
QuicClient.create()
.port(7777)
.bindAddress(() -> new InetSocketAddress(0))
.wiretap(true)
.secure(clientCtx)
.idleTimeout(Duration.ofSeconds(5))
.initialSettings(spec ->
spec.maxData(10000000)
.maxStreamDataBidirectionalLocal(1000000))
.connectNow();
Constructor and Description |
---|
QuicClient() |
Modifier and Type | Method and Description |
---|---|
T |
ackDelayExponent(long ackDelayExponent)
Set the delay exponent used for ACKs.
|
T |
activeMigration(boolean enable)
Enable/disable active migration.
|
T |
congestionControlAlgorithm(io.netty.incubator.codec.quic.QuicCongestionControlAlgorithm congestionControlAlgorithm)
Set the congestion control algorithm to use.
|
abstract Mono<? extends QuicConnection> |
connect()
|
QuicConnection |
connectNow()
Block the
QuicClient and return a QuicConnection . |
QuicConnection |
connectNow(Duration timeout)
Block the
QuicClient and return a QuicConnection . |
static QuicClient |
create()
Prepare a
QuicClient . |
T |
datagram(int recvQueueLen,
int sendQueueLen)
If configured this will enable
Datagram support.
|
T |
doOnBind(Consumer<? super CONF> doOnBind)
Set or add a callback called when
QuicTransport is about to start listening for incoming traffic. |
T |
doOnBound(Consumer<? super Connection> doOnBound)
Set or add a callback called after
QuicTransport has been started. |
QuicClient |
doOnConnect(Consumer<? super QuicClientConfig> doOnConnect)
Set or add a callback called when
QuicClient is about to connect to the remote endpoint. |
QuicClient |
doOnConnected(Consumer<? super QuicConnection> doOnConnected)
Set or add a callback called after
QuicConnection has been connected. |
QuicClient |
doOnDisconnected(Consumer<? super QuicConnection> doOnDisconnected)
Set or add a callback called after
QuicConnection has been disconnected. |
T |
doOnUnbound(Consumer<? super Connection> doOnUnbound)
Set or add a callback called after
QuicTransport has been shutdown. |
T |
grease(boolean enable)
Set if greasing should be enabled
or not.
|
T |
handleStream(BiFunction<? super QuicInbound,? super QuicOutbound,? extends Publisher<Void>> streamHandler)
Attach an IO handler to react on incoming stream.
|
QuicClient |
host(String host)
The host to which this client should connect.
|
T |
hystart(boolean enable)
Enable/disable Hystart.
|
T |
idleTimeout(Duration idleTimeout)
Set the maximum idle timeout (resolution: ms)
See
set_max_idle_timeout.
|
T |
initialSettings(Consumer<QuicInitialSettingsSpec.Builder> initialSettings)
Configure QUIC initial settings.
|
T |
localConnectionIdLength(int localConnectionIdLength)
Sets the local connection id length that is used.
|
T |
maxAckDelay(Duration maxAckDelay)
Set max ACK delay (resolution: ms).
|
T |
maxRecvUdpPayloadSize(long maxRecvUdpPayloadSize)
|
T |
maxSendUdpPayloadSize(long maxSendUdpPayloadSize)
|
QuicClient |
port(int port)
The port to which this client should connect.
|
QuicClient |
remoteAddress(Supplier<? extends SocketAddress> remoteAddressSupplier)
The address to which this client should connect on each subscribe.
|
T |
secure(Function<io.netty.incubator.codec.quic.QuicChannel,? extends io.netty.incubator.codec.quic.QuicSslEngine> sslEngineProvider)
|
T |
secure(io.netty.incubator.codec.quic.QuicSslContext sslContext)
The
QuicSslContext that will be used to create QuicSslEngine s for QuicChannel s. |
<A> T |
streamAttr(AttributeKey<A> key,
A value)
Injects default attribute to the future
QuicStreamChannel . |
T |
streamObserve(ConnectionObserver observer)
Set or add the given
ConnectionObserver for each stream. |
<A> T |
streamOption(ChannelOption<A> key,
A value)
Injects default options to the future
QuicStreamChannel . |
Mono<Void> |
warmup()
Based on the actual configuration, returns a
Mono that triggers:
an initialization of the event loop group
loads the necessary native libraries for the transport
By default, when method is not used, the bind operation absorbs the extra time needed to load resources. |
attr, bindAddress, channelGroup, configuration, doOnChannelInit, duplicate, metrics, metrics, observe, option, runOn, runOn, runOn, wiretap, wiretap, wiretap, wiretap, wiretap
public static QuicClient create()
QuicClient
.QuicClient
public abstract Mono<? extends QuicConnection> connect()
QuicClient
and return a Mono
of QuicConnection
. If
Mono
is cancelled, the underlying connection will be aborted. Once the
QuicConnection
has been emitted and is not necessary anymore, disposing must be
done by the user via DisposableChannel.dispose()
.Mono
of QuicConnection
public final QuicConnection connectNow()
QuicClient
and return a QuicConnection
. Disposing must be
done by the user via DisposableChannel.dispose()
. The max connection
timeout is 45 seconds.QuicConnection
public final QuicConnection connectNow(Duration timeout)
QuicClient
and return a QuicConnection
. Disposing must be
done by the user via DisposableChannel.dispose()
.timeout
- connect timeout (resolution: ns)QuicConnection
public final QuicClient doOnConnect(Consumer<? super QuicClientConfig> doOnConnect)
QuicClient
is about to connect to the remote endpoint.doOnConnect
- a consumer observing connect eventsQuicClient
referencepublic final QuicClient doOnConnected(Consumer<? super QuicConnection> doOnConnected)
QuicConnection
has been connected.doOnConnected
- a consumer observing connected eventsQuicClient
referencepublic final QuicClient doOnDisconnected(Consumer<? super QuicConnection> doOnDisconnected)
QuicConnection
has been disconnected.doOnDisconnected
- a consumer observing disconnected eventsQuicClient
referencepublic final QuicClient host(String host)
host
- the host to connect toQuicClient
referencepublic final QuicClient port(int port)
port
- the port to connect toQuicClient
referencepublic final QuicClient remoteAddress(Supplier<? extends SocketAddress> remoteAddressSupplier)
remoteAddressSupplier
- A supplier of the address to connect to.QuicClient
public final T ackDelayExponent(long ackDelayExponent)
ackDelayExponent
- the delay exponent used for ACKs.QuicTransport
referencepublic final T activeMigration(boolean enable)
true
.enable
- true
if migration should be enabled, false
otherwiseQuicTransport
referencepublic final T congestionControlAlgorithm(io.netty.incubator.codec.quic.QuicCongestionControlAlgorithm congestionControlAlgorithm)
QuicCongestionControlAlgorithm.CUBIC
.congestionControlAlgorithm
- the QuicCongestionControlAlgorithm
to use.QuicTransport
referencepublic final T datagram(int recvQueueLen, int sendQueueLen)
recvQueueLen
- the RECV queue length.sendQueueLen
- the SEND queue length.QuicTransport
referencepublic final T doOnBind(Consumer<? super CONF> doOnBind)
QuicTransport
is about to start listening for incoming traffic.doOnBind
- a consumer observing connected eventsQuicTransport
referencepublic final T doOnBound(Consumer<? super Connection> doOnBound)
QuicTransport
has been started.doOnBound
- a consumer observing connected eventsQuicTransport
referencepublic final T doOnUnbound(Consumer<? super Connection> doOnUnbound)
QuicTransport
has been shutdown.doOnUnbound
- a consumer observing unbound eventsQuicTransport
referencepublic final T grease(boolean enable)
true
.enable
- true
if enabled, false
otherwise.QuicTransport
referencepublic final T handleStream(BiFunction<? super QuicInbound,? super QuicOutbound,? extends Publisher<Void>> streamHandler)
Note: If an IO handler is not specified the incoming streams will be closed automatically.
streamHandler
- an IO handler that can dispose underlying connection when Publisher
terminates.QuicTransport
referencepublic final T hystart(boolean enable)
true
.enable
- true
if Hystart should be enabledQuicTransport
referencepublic final T idleTimeout(Duration idleTimeout)
By default idleTimeout
is not specified.
idleTimeout
- the maximum idle timeout (resolution: ms)QuicTransport
referencepublic final T initialSettings(Consumer<QuicInitialSettingsSpec.Builder> initialSettings)
initialSettings
- configures QUIC initial settingsQuicTransport
referencepublic final T localConnectionIdLength(int localConnectionIdLength)
localConnectionIdLength
- the length of local generated connections idsQuicTransport
referencepublic final T maxAckDelay(Duration maxAckDelay)
maxAckDelay
- the max ACK delay (resolution: ms)QuicTransport
referencepublic final T maxRecvUdpPayloadSize(long maxRecvUdpPayloadSize)
maxRecvUdpPayloadSize
- the maximum payload size that is advertised to the remote peer.QuicTransport
referencepublic final T maxSendUdpPayloadSize(long maxSendUdpPayloadSize)
maxSendUdpPayloadSize
- the maximum payload size that is advertised to the remote peer.QuicTransport
referencepublic final T secure(io.netty.incubator.codec.quic.QuicSslContext sslContext)
QuicSslContext
that will be used to create QuicSslEngine
s for QuicChannel
s.sslContext
- the QuicSslContext
QuicTransport
referencepublic final T secure(Function<io.netty.incubator.codec.quic.QuicChannel,? extends io.netty.incubator.codec.quic.QuicSslEngine> sslEngineProvider)
sslEngineProvider
- the Function
that will return the QuicSslEngine
that should be used for the QuicChannel
QuicTransport
referencepublic final <A> T streamAttr(AttributeKey<A> key, @Nullable A value)
QuicStreamChannel
. It
will be available via AttributeMap.attr(AttributeKey)
.
If the value
is null
, the attribute of the specified key
is removed.A
- the attribute typekey
- the attribute keyvalue
- the attribute value - null to remove a keyQuicTransport
referenceQuicStreamChannelBootstrap.attr(AttributeKey, Object)
,
QuicChannelBootstrap.streamAttr(AttributeKey, Object)
public T streamObserve(ConnectionObserver observer)
ConnectionObserver
for each stream.observer
- the ConnectionObserver
additionQuicTransport
referencepublic final <A> T streamOption(ChannelOption<A> key, @Nullable A value)
QuicStreamChannel
. It
will be available via QuicStreamChannel.config()
.
If the value
is null
, the attribute of the specified key
is removed.A
- the option typekey
- the option keyvalue
- the option value - null to remove a keyQuicTransport
referenceQuicStreamChannelBootstrap.option(ChannelOption, Object)
,
QuicChannelBootstrap.streamOption(ChannelOption, Object)
public final Mono<Void> warmup()
Mono
that triggers:
bind operation
absorbs the extra time needed to load resources.Mono
representing the completion of the warmup