Java Code Examples for io.grpc.internal.testing.TestUtils#installConscryptIfAvailable()

The following examples show how to use io.grpc.internal.testing.TestUtils#installConscryptIfAvailable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestServiceServer.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/** 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();
}
 
Example 2
Source File: TestServiceClient.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: TestServiceServer.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
/** 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();
}
 
Example 4
Source File: TestServiceClient.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 5
Source File: Http2OkHttpTest.java    From grpc-nebula-java with Apache License 2.0 4 votes vote down vote up
@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();
}
 
Example 6
Source File: TlsTest.java    From grpc-nebula-java with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void loadConscrypt() {
  TestUtils.installConscryptIfAvailable();
}
 
Example 7
Source File: Http2OkHttpTest.java    From grpc-java with Apache License 2.0 4 votes vote down vote up
@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();
}
 
Example 8
Source File: TlsTest.java    From grpc-java with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void loadConscrypt() {
  TestUtils.installConscryptIfAvailable();
}