Last active
November 10, 2022 01:36
-
-
Save StevenCurran/c486306b55187064a9d7f066d15d797e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import reactor.netty.DisposableServer; | |
import reactor.netty.tcp.TcpServer; | |
public class Application { | |
public static void main(String[] args) { | |
DisposableServer server = | |
TcpServer.create() | |
//inbound.connection.addHandlerLast() Is there a combiner I can use here? | |
.handle((inbound, outbound) -> { | |
//Tried to concat here, but then the flatMap is never called. | |
//return inbound.receive().asString().reduce(String::concat) | |
return inbound.receive().asString().flatMap(s -> { | |
//this is chunked, but I need the S to be the complete string. | |
NettyOutbound out = outbound.sendString(Mono.just(s.toUpperCase())); | |
return out | |
}) | |
.bindNow(); | |
server.onDispose() | |
.block(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment