See, eg, https://jira.mongodb.org/browse/JAVA-2559. This results
in errors like the following:
```
2021-06-12 17:15:58.893 13340-13412/com.example.rnldk E/AndroidRuntime: FATAL EXCEPTION: NioPeerHandler NIO Thread
Process: com.example.rnldk, PID: 13340
java.lang.NoSuchMethodError: No virtual method clear()Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer; or its super classes (declaration of 'java.nio.ByteBuffer' appears in /system/framework/core-oj.jar)
at org.ldk.batteries.NioPeerHandler.lambda$new$0$NioPeerHandler(NioPeerHandler.java:185)
at org.ldk.batteries.-$$Lambda$NioPeerHandler$f9v_DKRzmlYYXidLTlb3OtA-tVY.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:764)
```
import java.io.IOException;
import java.net.SocketAddress;
import java.net.StandardSocketOptions;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.*;
}
}
if (key.isValid() && (key.interestOps() & SelectionKey.OP_READ) != 0 && key.isReadable()) {
- buf.clear();
+ ((Buffer)buf).clear();
int read = ((SocketChannel) key.channel()).read(buf);
if (read == -1) {
this.peer_manager.socket_disconnected(peer.descriptor);
key.cancel();
} else if (read > 0) {
- buf.flip();
+ ((Buffer)buf).flip();
byte[] read_bytes = new byte[read];
buf.get(read_bytes, 0, read);
Result_boolPeerHandleErrorZ res = this.peer_manager.read_event(peer.descriptor, read_bytes);