Search in sources :

Example 21 with Connection

use of reactor.netty.Connection in project reactor-netty by reactor.

the class Application method main.

public static void main(String[] args) {
    Connection server = UdpServer.create().host(// <1>
    "localhost").port(// <2>
    8080).bindNow(Duration.ofSeconds(30));
    server.onDispose().block();
}
Also used : Connection(reactor.netty.Connection)

Example 22 with Connection

use of reactor.netty.Connection in project reactor-netty by reactor.

the class Application method main.

public static void main(String[] args) {
    Connection server = // <1>
    UdpServer.create().bindNow(// <2>
    Duration.ofSeconds(30));
    server.onDispose().block();
}
Also used : Connection(reactor.netty.Connection)

Example 23 with Connection

use of reactor.netty.Connection in project reactor-netty by reactor.

the class Application method main.

public static void main(String[] args) {
    Connection server = UdpServer.create().doOnBound(// <1>
    conn -> conn.addHandler(new LineBasedFrameDecoder(8192))).doOnChannelInit((observer, channel, remoteAddress) -> channel.pipeline().addFirst(// <2>
    new LoggingHandler("reactor.netty.examples"))).bindNow(Duration.ofSeconds(30));
    server.onDispose().block();
}
Also used : LineBasedFrameDecoder(io.netty.handler.codec.LineBasedFrameDecoder) LoggingHandler(io.netty.handler.logging.LoggingHandler) Duration(java.time.Duration) Connection(reactor.netty.Connection) UdpServer(reactor.netty.udp.UdpServer) LoggingHandler(io.netty.handler.logging.LoggingHandler) Connection(reactor.netty.Connection) LineBasedFrameDecoder(io.netty.handler.codec.LineBasedFrameDecoder)

Example 24 with Connection

use of reactor.netty.Connection in project reactor-netty by reactor.

the class Application method main.

public static void main(String[] args) {
    Connection server = UdpServer.create().wiretap("logger-name", LogLevel.DEBUG, // <1>
    AdvancedByteBufFormat.TEXTUAL).bindNow(Duration.ofSeconds(30));
    server.onDispose().block();
}
Also used : Connection(reactor.netty.Connection)

Example 25 with Connection

use of reactor.netty.Connection in project reactor-netty by reactor.

the class Application method main.

public static void main(String[] args) {
    LoopResources loop = LoopResources.create("event-loop", 1, 4, true);
    Connection server = UdpServer.create().runOn(loop).bindNow(Duration.ofSeconds(30));
    server.onDispose().block();
}
Also used : LoopResources(reactor.netty.resources.LoopResources) Connection(reactor.netty.Connection)

Aggregations

Connection (reactor.netty.Connection)137 Test (org.junit.jupiter.api.Test)69 CountDownLatch (java.util.concurrent.CountDownLatch)52 Duration (java.time.Duration)49 Mono (reactor.core.publisher.Mono)47 InetSocketAddress (java.net.InetSocketAddress)41 TimeUnit (java.util.concurrent.TimeUnit)39 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)38 LoopResources (reactor.netty.resources.LoopResources)38 ByteBuf (io.netty.buffer.ByteBuf)35 Flux (reactor.core.publisher.Flux)35 DisposableServer (reactor.netty.DisposableServer)35 DomainSocketAddress (io.netty.channel.unix.DomainSocketAddress)33 AtomicReference (java.util.concurrent.atomic.AtomicReference)32 List (java.util.List)31 IOException (java.io.IOException)30 Assertions.assertThatExceptionOfType (org.assertj.core.api.Assertions.assertThatExceptionOfType)30 ChannelOption (io.netty.channel.ChannelOption)29 Unpooled (io.netty.buffer.Unpooled)28 Charset (java.nio.charset.Charset)28