commit e1c7fdfac9788a85077610b2767021c2d688eeb6 parent 3552c783175e8b6612e7995aa9f8164f55ee39e7 Author: ms <ms@taler.net> Date: Wed, 6 Oct 2021 14:35:41 +0200 test for Unix domain socket Diffstat:
| A | util/src/test/kotlin/DomainSocketTest.kt | | | 31 | +++++++++++++++++++++++++++++++ |
1 file changed, 31 insertions(+), 0 deletions(-)
diff --git a/util/src/test/kotlin/DomainSocketTest.kt b/util/src/test/kotlin/DomainSocketTest.kt @@ -0,0 +1,30 @@ +import io.ktor.application.* +import io.ktor.features.* +import io.ktor.http.* +import io.ktor.response.* +import io.ktor.routing.* +import org.junit.Test +import io.ktor.jackson.jackson +import io.ktor.request.* + +class DomainSocketTest { + // @Test + fun bind() { + startServer("/tmp/java.sock") { + install(ContentNegotiation) { jackson() } + routing { + // responds with a empty JSON object. + get("/") { + this.call.respond(object {}) + return@get + } + // echoes what it read in the request. + post("/") { + val body = this.call.receiveText() + this.call.respondText(body) + return@post + } + } + } + } +} +\ No newline at end of file