下面列出了io.grpc.internal.testing.TestUtils#installConscryptIfAvailable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/** The main application allowing this server to be launched from the command line. */
public static void main(String[] args) throws Exception {
// Let Netty use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
final TestServiceServer server = new TestServiceServer();
server.parseArgs(args);
if (server.useTls) {
System.out.println(
"\nUsing fake CA for TLS certificate. Test clients should expect host\n"
+ "*.test.google.fr and our test CA. For the Java test client binary, use:\n"
+ "--server_host_override=foo.test.google.fr --use_test_ca=true\n");
}
Runtime.getRuntime()
.addShutdownHook(
new Thread() {
@Override
@SuppressWarnings("CatchAndPrintStackTrace")
public void run() {
try {
System.out.println("Shutting down");
server.stop();
} catch (Exception e) {
e.printStackTrace();
}
}
});
server.start();
System.out.println("Server started on port " + server.port);
server.blockUntilShutdown();
}
/**
* The main application allowing this client to be launched from the command line.
*/
public static void main(String[] args) throws Exception {
// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
final TestServiceClient client = new TestServiceClient();
client.parseArgs(args);
client.setUp();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
@SuppressWarnings("CatchAndPrintStackTrace")
public void run() {
System.out.println("Shutting down");
try {
client.tearDown();
} catch (Exception e) {
e.printStackTrace();
}
}
});
try {
client.run();
} finally {
client.tearDown();
}
System.exit(0);
}
/** The main application allowing this server to be launched from the command line. */
public static void main(String[] args) throws Exception {
// Let Netty use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
final TestServiceServer server = new TestServiceServer();
server.parseArgs(args);
if (server.useTls) {
System.out.println(
"\nUsing fake CA for TLS certificate. Test clients should expect host\n"
+ "*.test.google.fr and our test CA. For the Java test client binary, use:\n"
+ "--server_host_override=foo.test.google.fr --use_test_ca=true\n");
}
Runtime.getRuntime()
.addShutdownHook(
new Thread() {
@Override
@SuppressWarnings("CatchAndPrintStackTrace")
public void run() {
try {
System.out.println("Shutting down");
server.stop();
} catch (Exception e) {
e.printStackTrace();
}
}
});
server.start();
System.out.println("Server started on port " + server.port);
server.blockUntilShutdown();
}
/**
* The main application allowing this client to be launched from the command line.
*/
public static void main(String[] args) throws Exception {
// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
final TestServiceClient client = new TestServiceClient();
client.parseArgs(args);
client.setUp();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
@SuppressWarnings("CatchAndPrintStackTrace")
public void run() {
System.out.println("Shutting down");
try {
client.tearDown();
} catch (Exception e) {
e.printStackTrace();
}
}
});
try {
client.run();
} finally {
client.tearDown();
}
System.exit(0);
}
@BeforeClass
public static void loadConscrypt() throws Exception {
// Load conscrypt if it is available. Either Conscrypt or Jetty ALPN needs to be available for
// OkHttp to negotiate.
TestUtils.installConscryptIfAvailable();
}
@BeforeClass
public static void loadConscrypt() {
TestUtils.installConscryptIfAvailable();
}
@BeforeClass
public static void loadConscrypt() throws Exception {
// Load conscrypt if it is available. Either Conscrypt or Jetty ALPN needs to be available for
// OkHttp to negotiate.
TestUtils.installConscryptIfAvailable();
}
@BeforeClass
public static void loadConscrypt() {
TestUtils.installConscryptIfAvailable();
}