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()");
}
@OverrideView on GitHub (pinned to 64daddc1f3)
Solutions
- Do not read TCP-specific options (OOBINLINE, TCP_NODELAY, SO_LINGER, etc.) on UDS sockets.
- Guard option access with a UdsSocket class check or catch UnsupportedOperationException in shared socket-handling paths.
- 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
- Enumerate socket options only for plain TCP sockets.
- Treat all UdsSocket option accessors (keepAlive, OOBInline, linger, etc.) as unsupported.
- Configure behavior at the gRPC channel level rather than via raw socket options.
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
- Unsupported operation getKeepAlive()
- getChannel() not supported
- getInetAddress() not supported
- Unsupported operation getLocalAddress()
- Unsupported operation getLocalPort()
AI-assisted analysis of grpc/grpc-java@64daddc1f3 (2026-09-08).
Data as JSON: /api/errors/e0dd30bf4f05b31c.
Report an issue: GitHub.