use of reactor.netty.Connection in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
Connection connection = TcpClient.create().host("example.com").port(80).doOnConnected(conn -> conn.addHandler(new ReadTimeoutHandler(10, TimeUnit.SECONDS))).doOnChannelInit((observer, channel, remoteAddress) -> channel.pipeline().addFirst(// <2>
new LoggingHandler("reactor.netty.examples"))).connectNow();
connection.onDispose().block();
}
use of reactor.netty.Connection in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
ConnectionProvider provider = ConnectionProvider.builder("fixed").maxConnections(50).pendingAcquireTimeout(// <1>
Duration.ofSeconds(60)).build();
Connection connection = TcpClient.create(provider).host("example.com").port(80).connectNow();
connection.onDispose().block();
}
use of reactor.netty.Connection in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
Connection connection = TcpClient.create().host("example.com").port(80).proxy(spec -> spec.type(ProxyProvider.Proxy.SOCKS4).host("proxy").port(8080).nonProxyHosts("localhost").connectTimeoutMillis(// <1>
20_000)).connectNow();
connection.onDispose().block();
}
use of reactor.netty.Connection in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
Connection connection = UdpClient.create().bindAddress(Application::newDomainSocketAddress).remoteAddress(// <1>
() -> new DomainSocketAddress("/tmp/test-server.sock")).handle((in, out) -> out.sendString(Mono.just("hello")).then(in.receive().asString().doOnNext(System.out::println).then())).connectNow();
connection.onDispose().block();
}
use of reactor.netty.Connection in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
Connection connection = UdpClient.create().host(// <1>
"example.com").port(// <2>
80).connectNow(Duration.ofSeconds(30));
connection.onDispose().block();
}
Aggregations