diff options
author | Elliott Hughes <enh@google.com> | 2011-05-11 10:54:35 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-11 10:54:35 -0700 |
commit | 0038bf3674d6fedd4c1e884c7903f2fdcecb9127 (patch) | |
tree | cc9b8df566e91f70ef2f45e7be63b061e5cfda04 /support | |
parent | 2005fa732c2f13cb3405d31f3d45ea10afdff46f (diff) | |
parent | a7bb29434692e01aed843b88cd042628bab74a23 (diff) | |
download | libcore-0038bf3674d6fedd4c1e884c7903f2fdcecb9127.zip libcore-0038bf3674d6fedd4c1e884c7903f2fdcecb9127.tar.gz libcore-0038bf3674d6fedd4c1e884c7903f2fdcecb9127.tar.bz2 |
Merge "Clean up the select(2) implementation." into dalvik-dev
Diffstat (limited to 'support')
-rw-r--r-- | support/src/test/java/tests/net/StuckServer.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/support/src/test/java/tests/net/StuckServer.java b/support/src/test/java/tests/net/StuckServer.java index 4230f17..eababce 100644 --- a/support/src/test/java/tests/net/StuckServer.java +++ b/support/src/test/java/tests/net/StuckServer.java @@ -40,6 +40,24 @@ public final class StuckServer { } } + public void unblockAfterMs(final int ms) { + Thread t = new Thread(new Runnable() { + @Override public void run() { + try { + Thread.sleep(ms); + for (Socket client : clients) { + client.close(); + } + clients.clear(); + clients.add(serverSocket.accept()); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + }); + t.start(); + } + public InetSocketAddress getLocalSocketAddress() { return (InetSocketAddress) serverSocket.getLocalSocketAddress(); } |