OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.net; | 5 package org.chromium.net; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.ConditionVariable; | 8 import android.os.ConditionVariable; |
9 | 9 |
10 import org.chromium.base.Log; | 10 import org.chromium.base.Log; |
(...skipping 22 matching lines...) Expand all Loading... |
33 import io.netty.handler.ssl.OpenSslServerContext; | 33 import io.netty.handler.ssl.OpenSslServerContext; |
34 import io.netty.handler.ssl.SslContext; | 34 import io.netty.handler.ssl.SslContext; |
35 import io.netty.handler.ssl.SupportedCipherSuiteFilter; | 35 import io.netty.handler.ssl.SupportedCipherSuiteFilter; |
36 | 36 |
37 /** | 37 /** |
38 * Wrapper class to start a HTTP/2 test server. | 38 * Wrapper class to start a HTTP/2 test server. |
39 */ | 39 */ |
40 public final class Http2TestServer { | 40 public final class Http2TestServer { |
41 private static final ConditionVariable sBlock = new ConditionVariable(); | 41 private static final ConditionVariable sBlock = new ConditionVariable(); |
42 private static Channel sServerChannel; | 42 private static Channel sServerChannel; |
43 private static final String TAG = "Http2TestServer"; | 43 private static final String TAG = Http2TestServer.class.getSimpleName(); |
44 | 44 |
45 private static final String HOST = "127.0.0.1"; | 45 private static final String HOST = "127.0.0.1"; |
46 // Server port. | 46 // Server port. |
47 private static final int PORT = 8443; | 47 private static final int PORT = 8443; |
48 | 48 |
49 public static boolean shutdownHttp2TestServer() throws Exception { | 49 public static boolean shutdownHttp2TestServer() throws Exception { |
50 if (sServerChannel != null) { | 50 if (sServerChannel != null) { |
51 sServerChannel.close(); | 51 sServerChannel.close(); |
52 sServerChannel = null; | 52 sServerChannel = null; |
53 return true; | 53 return true; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 throws Exception { | 170 throws Exception { |
171 if (ApplicationProtocolNames.HTTP_2.equals(protocol)) { | 171 if (ApplicationProtocolNames.HTTP_2.equals(protocol)) { |
172 ctx.pipeline().addLast(new Http2TestHandler.Builder().build()); | 172 ctx.pipeline().addLast(new Http2TestHandler.Builder().build()); |
173 return; | 173 return; |
174 } | 174 } |
175 | 175 |
176 throw new IllegalStateException("unknown protocol: " + protocol); | 176 throw new IllegalStateException("unknown protocol: " + protocol); |
177 } | 177 } |
178 } | 178 } |
179 } | 179 } |
OLD | NEW |