Closing connections is possible by cancelling the incoming connection Flow from your server logic (e.g. by connecting its downstream to an CancelledSink and its upstream to a completed Source). It is also possible to shut down the servers socket by cancelling the connections:Source[IncomingConnection].
conn.flow.concat(Source.empty).to(Sink.cancelled)
ctx.pushAndFinish(elem)