diff options
author | Elliott Hughes <enh@google.com> | 2012-07-18 18:06:40 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2012-07-18 18:06:40 -0700 |
commit | 903b3f5b6a6e524cb4d88b83ea32e7c355392271 (patch) | |
tree | 07313bd58f54e30046384e83d8bed45485cdf450 /support | |
parent | 7b218fdfcc6cdf32c9b1c9fc5acf8b353705965a (diff) | |
download | libcore-903b3f5b6a6e524cb4d88b83ea32e7c355392271.zip libcore-903b3f5b6a6e524cb4d88b83ea32e7c355392271.tar.gz libcore-903b3f5b6a6e524cb4d88b83ea32e7c355392271.tar.bz2 |
Start removing Support_PortManager.
A bad idea, badly implemented.
Bug: 2441548
Change-Id: I34c990f6fd9d746771846f186a7ab3ab59e78a9f
Diffstat (limited to 'support')
-rw-r--r-- | support/src/test/java/tests/support/Support_TestWebServer.java | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/support/src/test/java/tests/support/Support_TestWebServer.java b/support/src/test/java/tests/support/Support_TestWebServer.java index 4d6b0d1..5f3cd85 100644 --- a/support/src/test/java/tests/support/Support_TestWebServer.java +++ b/support/src/test/java/tests/support/Support_TestWebServer.java @@ -94,51 +94,21 @@ public class Support_TestWebServer implements Support_HttpConstants { } /** - * Initialize a new server with default port and timeout. - * @param log Set true if you want trace output - */ - public int initServer(boolean log) throws Exception { - return initServer(0, DEFAULT_TIMEOUT, log); - } - - /** - * Initialize a new server with default timeout. - * @param port Sets the server to listen on this port, or 0 to let the OS choose. - * Hard-coding ports is evil, so always pass 0. - * @param log Set true if you want trace output - */ - public int initServer(int port, boolean log) throws Exception { - return initServer(port, DEFAULT_TIMEOUT, log); - } - - /** - * Initialize a new server with default timeout and disabled log. - * @param port Sets the server to listen on this port, or 0 to let the OS choose. - * Hard-coding ports is evil, so always pass 0. * @param servePath the path to the dynamic web test data * @param contentType the type of the dynamic web test data */ - public int initServer(int port, String servePath, String contentType) - throws Exception { + public int initServer(String servePath, String contentType) throws Exception { Support_TestWebData.initDynamicTestWebData(servePath, contentType); - return initServer(port, DEFAULT_TIMEOUT, false); + return initServer(); } - /** - * Initialize a new server with default port and timeout. - * @param port Sets the server to listen on this port, or 0 to let the OS choose. - * Hard-coding ports is evil, so always pass 0. - * @param timeout Indicates the period of time to wait until a socket is - * closed - * @param log Set true if you want trace output - */ - public int initServer(int port, int timeout, boolean log) throws Exception { - mTimeout = timeout; - mLog = log; + public int initServer() throws Exception { + mTimeout = DEFAULT_TIMEOUT; + mLog = false; keepAlive = true; if (acceptT == null) { acceptT = new AcceptThread(); - mPort = acceptT.init(port); + mPort = acceptT.init(); acceptT.start(); } return mPort; @@ -253,8 +223,8 @@ public class Support_TestWebServer implements Support_HttpConstants { * @param port the port to use, or 0 to let the OS choose. * Hard-coding ports is evil, so always pass 0! */ - public int init(int port) throws IOException { - ss = new ServerSocket(port); + public int init() throws IOException { + ss = new ServerSocket(0); ss.setSoTimeout(5000); ss.setReuseAddress(true); return ss.getLocalPort(); |