Package 

Class UdsChannelBuilder


  • @ExperimentalApi(value = A stopgap. Not intended to be stabilized) 
    public final class UdsChannelBuilder
    
                        

    Creates a UDS channel by passing in a specialized SocketFactory into an OkHttpChannelBuilder. The UdsSockets produced by this factory communicate over Android's LocalSockets.

    Example Usage Channel channel = UdsChannelBuilder.forPath("/data/data/my.app/app.socket", Namespace.FILESYSTEM).build(); stub = MyService.newStub(channel);

    This class uses a safe-for-production hack to workaround NameResolver's inability to safely return non-IP SocketAddress types. The hack simply ignores the name resolver results and connects to the UDS name provided during construction instead. This class is expected to be replaced with a `unix:` name resolver when possible.

    • Method Summary

      Modifier and Type Method Description
      static ManagedChannelBuilder<out Object> forPath(String path, LocalSocketAddress.Namespace namespace) Returns a channel to the UDS endpoint specified by the file-path.
      • Methods inherited from class java.lang.Object

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

      • forPath

         static ManagedChannelBuilder<out Object> forPath(String path, LocalSocketAddress.Namespace namespace)

        Returns a channel to the UDS endpoint specified by the file-path.

        Parameters:
        path - unix file system path to use for Unix Domain Socket.
        namespace - the type of the namespace that the path belongs to.