From 8e5c4a139a3e81425bf3b91d42f9bfe66ccd3a73 Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Fri, 23 Feb 2018 21:31:45 +0100 Subject: [PATCH] fix test-cases using IPv6 --- tests/tcpproxy/source/app.d | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/tcpproxy/source/app.d b/tests/tcpproxy/source/app.d index 937f7c1dc8..150bf7cf09 100644 --- a/tests/tcpproxy/source/app.d +++ b/tests/tcpproxy/source/app.d @@ -38,6 +38,9 @@ void testProtocol(TCPConnection server, bool terminate) void runTest() { + import std.algorithm : find; + import std.socket : AddressFamily; + // server for a simple line based protocol auto l1 = listenTCP(0, (client) { while (!client.empty) { @@ -50,7 +53,7 @@ void runTest() client.write(format("Hash: %08X\r\n", typeid(string).getHash(&ln))); } - })[0]; + }).find!(l => l.bindAddress.family == AddressFamily.INET).front; scope (exit) l1.stopListening; // proxy server @@ -71,7 +74,7 @@ void runTest() } server.write(client); logInfo("Proxy out"); - })[0]; + }).find!(l => l.bindAddress.family == AddressFamily.INET).front; scope (exit) l2.stopListening; // test server