Merge pull request #18924 from 2beaucoup/improve-tcp-doc

Show where connections are coming from in stream-io.rst
This commit is contained in:
Konrad Malawski 2015-11-18 12:01:12 +01:00
commit a394e833bf
2 changed files with 4 additions and 5 deletions

View file

@ -38,13 +38,12 @@ class StreamTcpDocSpec extends AkkaSpec {
//#echo-server-simple-bind
}
{
val localhost = TestUtils.temporaryServerAddress()
val connections: Source[IncomingConnection, Future[ServerBinding]] =
Tcp().bind(localhost.getHostName, localhost.getPort) // TODO getHostString in Java7
val (host, port) = TestUtils.temporaryServerHostnameAndPort()
//#echo-server-simple-handle
import akka.stream.io.Framing
val connections: Source[IncomingConnection, Future[ServerBinding]] =
Tcp().bind(host, port)
connections runForeach { connection =>
println(s"New connection from: ${connection.remoteAddress}")

View file

@ -19,6 +19,6 @@ object TestUtils {
def temporaryServerHostnameAndPort(interface: String = "127.0.0.1"): (String, Int) = {
val socketAddress = temporaryServerAddress(interface)
socketAddress.getHostName -> socketAddress.getPort
socketAddress.getHostName -> socketAddress.getPort // TODO getHostString in Java7
}
}