Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from svinci/master
scala 2.11 support
- Loading branch information
Showing
5 changed files
with
109 additions
and
84 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
logs | ||
project/project | ||
project/target | ||
target | ||
tmp | ||
.history | ||
dist | ||
/.idea | ||
/*.iml | ||
META-INF | ||
/out | ||
/.idea_modules | ||
/.classpath | ||
/.project | ||
/RUNNING_PID | ||
/.settings |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.jfarcand.wcs.test | ||
|
||
import java.util.concurrent.CountDownLatch | ||
|
||
import org.jfarcand.wcs.{MessageListener, WebSocket} | ||
import org.scalatest.{Matchers, FlatSpec} | ||
|
||
class WSSTest extends FlatSpec with Matchers { | ||
|
||
it should "receive three messages" in { | ||
val w = WebSocket() | ||
val latch: CountDownLatch = new CountDownLatch(3) | ||
var messages: Seq[String] = Seq() | ||
w open "wss://stream.pushbullet.com/websocket/wHDLQQ4cWz7uH89MjpKh47dcc8AhyFrd" listener new MessageListener { | ||
override def onMessage(message: String): Unit = { | ||
println(message) | ||
messages = messages ++ Seq(message) | ||
latch.countDown() | ||
} | ||
override def onOpen: Unit = println("open connection") | ||
override def onClose: Unit = println("close connection") | ||
override def onClose(code: Int, reason: String): Unit = println(s"close connection, code ${code.toString}. reason: $reason") | ||
override def onError(t: Throwable): Unit = t.printStackTrace() | ||
override def onMessage(message: Array[Byte]): Unit = onMessage(new String(message)) | ||
} | ||
latch.await() | ||
assert(messages.size == 3) | ||
} | ||
|
||
} |
Oops, something went wrong.