use of reactor.netty.tcp.TcpSslContextSpec in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
File cert = new File("certificate.crt");
File key = new File("private.key");
TcpSslContextSpec tcpSslContextSpec = TcpSslContextSpec.forServer(cert, key);
DisposableServer server = TcpServer.create().secure(spec -> spec.sslContext(tcpSslContextSpec)).bindNow();
server.onDispose().block();
}
use of reactor.netty.tcp.TcpSslContextSpec in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
TcpSslContextSpec tcpSslContextSpec = TcpSslContextSpec.forClient();
Connection connection = TcpClient.create().host("example.com").port(443).secure(spec -> spec.sslContext(tcpSslContextSpec)).connectNow();
connection.onDispose().block();
}
use of reactor.netty.tcp.TcpSslContextSpec in project reactor-netty by reactor.
the class DiscardClient method main.
public static void main(String[] args) {
TcpClient client = TcpClient.create().port(PORT).wiretap(WIRETAP);
if (SECURE) {
TcpSslContextSpec tcpSslContextSpec = TcpSslContextSpec.forClient().configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
client = client.secure(spec -> spec.sslContext(tcpSslContextSpec));
}
Connection connection = client.handle((in, out) -> {
// Discards the incoming data and releases the buffers
in.receive().subscribe();
return out.sendString(Flux.interval(Duration.ofMillis(100)).map(l -> l + ""));
}).connectNow();
connection.onDispose().block();
}
use of reactor.netty.tcp.TcpSslContextSpec in project reactor-netty by reactor.
the class EchoClient method main.
public static void main(String[] args) {
TcpClient client = TcpClient.create().port(PORT).wiretap(WIRETAP);
if (SECURE) {
TcpSslContextSpec tcpSslContextSpec = TcpSslContextSpec.forClient().configure(builder -> builder.trustManager(InsecureTrustManagerFactory.INSTANCE));
client = client.secure(spec -> spec.sslContext(tcpSslContextSpec));
}
Connection connection = client.handle((in, out) -> out.send(Flux.concat(ByteBufFlux.fromString(Mono.just("echo")), in.receive().retain()))).connectNow();
connection.onDispose().block();
}
Aggregations