=doc show where connections are coming from in stream-io.rst
This commit is contained in:
parent
4e127e6206
commit
6ba1e481d3
2 changed files with 4 additions and 5 deletions
|
|
@ -38,13 +38,12 @@ class StreamTcpDocSpec extends AkkaSpec {
|
||||||
//#echo-server-simple-bind
|
//#echo-server-simple-bind
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
val localhost = TestUtils.temporaryServerAddress()
|
val (host, port) = TestUtils.temporaryServerHostnameAndPort()
|
||||||
val connections: Source[IncomingConnection, Future[ServerBinding]] =
|
|
||||||
Tcp().bind(localhost.getHostName, localhost.getPort) // TODO getHostString in Java7
|
|
||||||
|
|
||||||
//#echo-server-simple-handle
|
//#echo-server-simple-handle
|
||||||
import akka.stream.io.Framing
|
import akka.stream.io.Framing
|
||||||
|
|
||||||
|
val connections: Source[IncomingConnection, Future[ServerBinding]] =
|
||||||
|
Tcp().bind(host, port)
|
||||||
connections runForeach { connection =>
|
connections runForeach { connection =>
|
||||||
println(s"New connection from: ${connection.remoteAddress}")
|
println(s"New connection from: ${connection.remoteAddress}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,6 @@ object TestUtils {
|
||||||
|
|
||||||
def temporaryServerHostnameAndPort(interface: String = "127.0.0.1"): (String, Int) = {
|
def temporaryServerHostnameAndPort(interface: String = "127.0.0.1"): (String, Int) = {
|
||||||
val socketAddress = temporaryServerAddress(interface)
|
val socketAddress = temporaryServerAddress(interface)
|
||||||
socketAddress.getHostName -> socketAddress.getPort
|
socketAddress.getHostName -> socketAddress.getPort // TODO getHostString in Java7
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue