grpc/grpc-java · error · UnsupportedOperationException

Unsupported operation getOOBInline()

Error message

Unsupported operation getOOBInline()

What it means

UdsSocket emulates java.net.Socket over an Android LocalSocket. TCP out-of-band inline data (OOBINLINE, urgent data) has no counterpart on LocalSocket/Unix Domain Sockets, so getOOBInline() throws UnsupportedOperationException by design, like the other unsupported TCP option accessors in this class.

Source

Thrown at android/src/main/java/io/grpc/android/UdsSocket.java:133

  @Override
  public InetAddress getLocalAddress() {
    throw new UnsupportedOperationException("Unsupported operation getLocalAddress()");
  }

  @Override
  public int getLocalPort() {
    throw new UnsupportedOperationException("Unsupported operation getLocalPort()");
  }

  @Override
  public SocketAddress getLocalSocketAddress() {
    return new SocketAddress() {};
  }

  @Override
  public boolean getOOBInline() {
    throw new UnsupportedOperationException("Unsupported operation getOOBInline()");
  }

  @Override
  public OutputStream getOutputStream() throws IOException {
    return new FilterOutputStream(localSocket.getOutputStream()) {
      @Override
      public void close() throws IOException {
        UdsSocket.this.close();
      }
    };
  }

  @Override
  public int getPort() {
    throw new UnsupportedOperationException("Unsupported operation getPort()");
  }

  @Override

View on GitHub (pinned to 64daddc1f3)

Solutions

  1. Do not read TCP-specific options (OOBINLINE, TCP_NODELAY, SO_LINGER, etc.) on UDS sockets.
  2. Guard option access with a UdsSocket class check or catch UnsupportedOperationException in shared socket-handling paths.
  3. Set channel-level behavior via gRPC channel options instead of raw socket options.

Example fix

// before
boolean oob = socket.getOOBInline();
// after
boolean oob = socket.getClass().getSimpleName().equals("UdsSocket")
    ? false
    : socket.getOOBInline();
Defensive patterns

Strategy: type-guard

Type guard

static boolean supportsTcpOptions(Socket s) {
  return !s.getClass().getName().equals("io.grpc.android.UdsSocket");
}

Try / catch

try {
  boolean oob = socket.getOOBInline();
} catch (UnsupportedOperationException e) {
  // UDS socket: TCP urgent-data options do not apply
}

Prevention

When it happens

Trigger: Calling getOOBInline() on the UdsSocket produced by UdsSocketFactory — typically generic socket-option snapshot code or libraries that read all TCP options after connect.

Common situations: Connection diagnostics tools enumerating socket options; code ported from TCP-only contexts that unconditionally reads OOBINLINE; test harnesses asserting socket configuration.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of grpc/grpc-java@64daddc1f3 (2026-09-08). Data as JSON: /api/errors/e0dd30bf4f05b31c. Report an issue: GitHub.