Search in sources :

Example 6 with TcpServer

use of reactor.netty.tcp.TcpServer in project reactor-netty by reactor.

the class EchoServer method main.

public static void main(String[] args) throws Exception {
    TcpServer server = TcpServer.create().port(PORT).wiretap(WIRETAP).handle((in, out) -> out.send(in.receive().retain()));
    if (SECURE) {
        SelfSignedCertificate ssc = new SelfSignedCertificate();
        server = server.secure(spec -> spec.sslContext(TcpSslContextSpec.forServer(ssc.certificate(), ssc.privateKey())));
    }
    server.bindNow().onDispose().block();
}
Also used : SelfSignedCertificate(io.netty.handler.ssl.util.SelfSignedCertificate) TcpSslContextSpec(reactor.netty.tcp.TcpSslContextSpec) TcpServer(reactor.netty.tcp.TcpServer) SelfSignedCertificate(io.netty.handler.ssl.util.SelfSignedCertificate) TcpServer(reactor.netty.tcp.TcpServer)

Aggregations

TcpServer (reactor.netty.tcp.TcpServer)6 SelfSignedCertificate (io.netty.handler.ssl.util.SelfSignedCertificate)2 DisposableServer (reactor.netty.DisposableServer)2 TcpSslContextSpec (reactor.netty.tcp.TcpSslContextSpec)2