socket.reuse-address on windows doesn't work from ServerConnector

This commit is contained in:
Joakim Erdfelt 2015-04-28 08:32:20 -07:00
parent c17f1982be
commit 084a307ea1
1 changed files with 19 additions and 3 deletions

View File

@ -45,6 +45,7 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.toolchain.test.OS;
import org.eclipse.jetty.util.IO;
import org.junit.Test;
@ -129,7 +130,12 @@ public class ServerConnectorTest
String response = getResponse(uri);
assertThat("Response",response,containsString("connector.getReuseAddress() = true"));
assertThat("Response",response,containsString("connector._reuseAddress() = true"));
assertThat("Response",response,containsString("socket.getReuseAddress() = true"));
// Java on Windows is incapable of propagating reuse-address this to the opened socket.
if (!OS.IS_WINDOWS)
{
assertThat("Response",response,containsString("socket.getReuseAddress() = true"));
}
}
finally
{
@ -160,7 +166,12 @@ public class ServerConnectorTest
String response = getResponse(uri);
assertThat("Response",response,containsString("connector.getReuseAddress() = true"));
assertThat("Response",response,containsString("connector._reuseAddress() = true"));
assertThat("Response",response,containsString("socket.getReuseAddress() = true"));
// Java on Windows is incapable of propagating reuse-address this to the opened socket.
if (!OS.IS_WINDOWS)
{
assertThat("Response",response,containsString("socket.getReuseAddress() = true"));
}
}
finally
{
@ -191,7 +202,12 @@ public class ServerConnectorTest
String response = getResponse(uri);
assertThat("Response",response,containsString("connector.getReuseAddress() = false"));
assertThat("Response",response,containsString("connector._reuseAddress() = false"));
assertThat("Response",response,containsString("socket.getReuseAddress() = false"));
// Java on Windows is incapable of propagating reuse-address this to the opened socket.
if (!OS.IS_WINDOWS)
{
assertThat("Response",response,containsString("socket.getReuseAddress() = false"));
}
}
finally
{