The spec at https://github.com/rubysl/rubysl-socket/blob/3950231ce2af8a438deeaa6006fd177356149823/spec/basicsocket/getsockopt_spec.rb currently fails with the following output found at https://gist.github.com/YorickPeterse/d98ec87d068f7237220e
Looking at https://github.com/jruby/jruby/blob/3c164ca93d1e60373fd5f2c7f1895915fb8c577e/core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java#L670-L688 it seems JRuby assumes the level/optname prefixes are always SOL_/SO_ instead of basing the prefix on the level.
For Rubinius we use the following code to determine the prefixes: https://github.com/rubysl/rubysl-socket/blob/ff68150719df6bedc72ec159fc2e5f166851e800/lib/rubysl/socket/socket_options.rb#L4-L49
Looking at the spec output it also seems JRuby doesn't implement everything of Socket::Option, e.g. the bool and linger methods.
Yes, this is known. We do not use FFI to implement socket and are limited in how many options the JDK Socket classes support.
Fix passing socket option in a form of SO_OPTION
Socket::Option.new(:UNSPEC, :SOCKET, :SO_LINGER, [0, 0].pack('i*')
Fix passing socket level in a form of SOL_LEVEL
Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :LINGER, 1)