Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a general-purpose websocket client #128

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

bbaldino
Copy link
Member

No description provided.

class WebSocketClientTest : ShouldSpec() {
override fun isolationMode(): IsolationMode? = IsolationMode.InstancePerLeaf

private val wsPort = Random.nextInt(1024, 65535).also {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail randomly because of colisions. Do you know if there's a way to make ktor bind on an ephemeral port?

println("Server running on port $it")
}

private val client = HttpClient(CIO) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is redundant (since WebSocketClient defaults to the same) or defined here for reuse?

Thread.sleep(1000)
ws.sendString("hello")
ws.stop()
Thread.sleep(1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this test for, just lack of exceptions? Are both sleep calls necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants