This repo implements an Android 5+ app that runs a Netty-powered KTor server when the app is in the foreground.
The server runs on 0.0.0.0:13276 without TLS.
MainActivity contains the KTor server code.
This app implements two endpoints:
It returns a 200 OK with a text body (text/plain) that contains the model name of the device the server runs on.
This is a WebSocket endpoint that implements the following protocol:
- Client connects to server.
- Server sends text message to client.
- Server waits for client to send message back (any message).
- Server closes connection as soon as message from client is received.
ServerTest contains a test that checks the endpoints above.
Make sure to set the right IP to your Android device on your WiFi network.
This repo is in the public domain.