summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-12-30 15:44:15 (EST)
committerEike Stepper2007-12-30 15:44:15 (EST)
commit043d8cb3d754fe45e972a7862cdc355e549b5568 (patch)
tree060ad0197522b49f57c4c5651f53d220845b25ed
parentc425fb554da58f0a616bf3ec488058863873a67a (diff)
downloadcdo-043d8cb3d754fe45e972a7862cdc355e549b5568.zip
cdo-043d8cb3d754fe45e972a7862cdc355e549b5568.tar.gz
cdo-043d8cb3d754fe45e972a7862cdc355e549b5568.tar.bz2
[213748] Connection delays with Windows Vista
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213748
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/Performance.java29
1 files changed, 25 insertions, 4 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/Performance.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/Performance.java
index 6dee94d..6b3a457 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/Performance.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/Performance.java
@@ -1,4 +1,5 @@
package org.eclipse.net4j.tests;
+
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -19,6 +20,7 @@ public class Performance
{
testInetAddress();
testServerSocket();
+ // testRouter();
testSocket();
testSelector();
}
@@ -51,11 +53,30 @@ public class Performance
}
}
+ public static void testRouter() throws Exception
+ {
+ System.out.println(Socket.class.getName() + " (ROUTER)");
+ for (int i = 0; i < 2; i++)
+ {
+ final SocketAddress endpoint = new InetSocketAddress(InetAddress.getByName("192.168.1.1"), 80);
+ Socket socket = new Socket(Proxy.NO_PROXY);
+
+ long start = System.currentTimeMillis();
+ socket.connect(endpoint);
+ long duration = System.currentTimeMillis() - start;
+
+ System.out.println(duration);
+ socket.close();
+ Thread.sleep(500);
+ }
+ }
+
public static void testSocket() throws Exception
{
- System.out.println(Socket.class.getName());
+ System.out.println(Socket.class.getName() + " (LOOPBACK)");
for (int i = 0; i < 2; i++)
{
+ final SocketAddress endpoint = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 2036);
final CountDownLatch latch = new CountDownLatch(1);
new Thread()
{
@@ -64,7 +85,8 @@ public class Performance
{
try
{
- ServerSocket serverSocket = new ServerSocket(2036);
+ ServerSocket serverSocket = new ServerSocket();
+ serverSocket.bind(endpoint);
latch.countDown();
Socket socket = serverSocket.accept();
@@ -81,15 +103,14 @@ public class Performance
latch.await();
Thread.sleep(500);
-
Socket socket = new Socket(Proxy.NO_PROXY);
- SocketAddress endpoint = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 2036);
long start = System.currentTimeMillis();
socket.connect(endpoint);
long duration = System.currentTimeMillis() - start;
System.out.println(duration);
+ socket.close();
Thread.sleep(500);
}
}