Class TestUtils


  • @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1791")
    public class TestUtils
    extends java.lang.Object
    Common utility functions useful for writing tests.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TestUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.security.cert.X509Certificate loadX509Cert​(java.lang.String fileName)
      Deprecated.
      Not for public use
      static javax.net.ssl.SSLSocketFactory newSslSocketFactoryForCa​(java.security.Provider provider, java.io.File certChainFile)
      Deprecated.
      Not for public use
      static java.util.List<java.lang.String> preferredTestCiphers()
      Deprecated.
      Not for public use
      static io.grpc.ServerInterceptor recordRequestHeadersInterceptor​(java.util.concurrent.atomic.AtomicReference<io.grpc.Metadata> headersCapture)
      Capture the request headers from a client.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestUtils

        private TestUtils()
    • Method Detail

      • recordRequestHeadersInterceptor

        public static io.grpc.ServerInterceptor recordRequestHeadersInterceptor​(java.util.concurrent.atomic.AtomicReference<io.grpc.Metadata> headersCapture)
        Capture the request headers from a client. Useful for testing metadata propagation.
      • preferredTestCiphers

        @Deprecated
        public static java.util.List<java.lang.String> preferredTestCiphers()
        Deprecated.
        Not for public use
        Returns the ciphers preferred to use during tests. They may be chosen because they are widely available or because they are fast. There is no requirement that they provide confidentiality or integrity.
      • loadX509Cert

        @Deprecated
        public static java.security.cert.X509Certificate loadX509Cert​(java.lang.String fileName)
                                                               throws java.security.cert.CertificateException,
                                                                      java.io.IOException
        Deprecated.
        Not for public use
        Loads an X.509 certificate from the classpath resources in src/main/resources/certs.
        Parameters:
        fileName - name of a file in src/main/resources/certs.
        Throws:
        java.security.cert.CertificateException
        java.io.IOException
      • newSslSocketFactoryForCa

        @Deprecated
        public static javax.net.ssl.SSLSocketFactory newSslSocketFactoryForCa​(java.security.Provider provider,
                                                                              java.io.File certChainFile)
                                                                       throws java.lang.Exception
        Deprecated.
        Not for public use
        Creates an SSLSocketFactory which contains certChainFile as its only root certificate.
        Throws:
        java.lang.Exception