Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1331)

Unified Diff: net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java

Issue 514443002: Revert "TestWebServer needs to use a free port." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java
diff --git a/net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java b/net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java
index eaa762331e9868b08f5ff2a75cef0872ab808ea5..53202a9f3cbd819474748873a8723806809d9070 100644
--- a/net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java
+++ b/net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java
@@ -62,6 +62,8 @@ import javax.net.ssl.X509TrustManager;
*/
public class TestWebServer {
private static final String TAG = "TestWebServer";
+ private static final int SERVER_PORT = 4444;
+ private static final int SSL_SERVER_PORT = 4445;
public static final String SHUTDOWN_PREFIX = "/shutdown";
@@ -106,21 +108,19 @@ public class TestWebServer {
public TestWebServer(boolean ssl) throws Exception {
mSsl = ssl;
if (mSsl) {
- mServerUri = "https:";
if (sSecureInstance != null) {
sSecureInstance.shutdown();
}
+ mServerUri = "https://localhost:" + SSL_SERVER_PORT;
} else {
- mServerUri = "http:";
if (sInstance != null) {
sInstance.shutdown();
}
+ mServerUri = "http://localhost:" + SERVER_PORT;
}
-
setInstance(this, mSsl);
mServerThread = new ServerThread(this, mSsl);
mServerThread.start();
- mServerUri += "//localhost:" + mServerThread.mSocket.getLocalPort();
}
/**
@@ -552,9 +552,10 @@ public class TestWebServer {
if (mIsSsl) {
mSslContext = SSLContext.getInstance("TLS");
mSslContext.init(getKeyManagers(), null, null);
- mSocket = mSslContext.getServerSocketFactory().createServerSocket(0);
+ mSocket = mSslContext.getServerSocketFactory().createServerSocket(
+ SSL_SERVER_PORT);
} else {
- mSocket = new ServerSocket(0);
+ mSocket = new ServerSocket(SERVER_PORT);
}
return;
} catch (IOException e) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698