Copying jruby/jruby#2992 here per @headius suggestion, see jruby/jruby#2992 (comment) for rationale.
Testcase:
require 'socket'
require 'openssl'
from, to = UNIXSocket.pair
ssl_to = OpenSSL::SSL::SSLSocket.new(to)
ssl_to.write('foo')
fails with
SSLSocket.java:858:in `getSocketChannel': java.lang.ClassCastException: jnr.unixsocket.UnixSocketChannel cannot be cast to java.nio.channels.SocketChannel
from SSLSocket.java:726:in `checkClosed'
from SSLSocket.java:687:in `do_syswrite'
from SSLSocket.java:711:in `syswrite'
from SSLSocket$INVOKER$i$1$0$syswrite.gen:-1:in `call'
from CachingCallSite.java:313:in `cacheAndCall'
from CachingCallSite.java:163:in `call'
from InterpreterEngine.java:292:in `processCall'
from StartupInterpreterEngine.java:78:in `interpret'
from InterpreterEngine.java:84:in `interpret'
from MixedModeIRMethod.java:199:in `INTERPRET_METHOD'
from MixedModeIRMethod.java:185:in `call'
from DynamicMethod.java:205:in `call'
from CachingCallSite.java:313:in `cacheAndCall'
from CachingCallSite.java:163:in `call'
from InterpreterEngine.java:292:in `processCall'
from StartupInterpreterEngine.java:78:in `interpret'
from InterpreterEngine.java:84:in `interpret'
from MixedModeIRMethod.java:199:in `INTERPRET_METHOD'
from MixedModeIRMethod.java:185:in `call'
from DynamicMethod.java:205:in `call'
from CachingCallSite.java:313:in `cacheAndCall'
from CachingCallSite.java:163:in `call'
from /tmp/socket.rb:-1:in `invokeOther9:write'
from /tmp/socket.rb:6:in `RUBY$script'
from MethodHandle.java:625:in `invokeWithArguments'
from Compiler.java:111:in `load'
from Ruby.java:833:in `runScript'
from Ruby.java:822:in `runScript'
from Ruby.java:752:in `runNormally'
from Ruby.java:574:in `runFromMain'
from Main.java:401:in `doRunFromMain'
from Main.java:296:in `internalRun'
from Main.java:225:in `run'
from Main.java:197:in `main'
on JRuby jruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-05-26 78b009c Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64], no error on MRI (tested with 1.9 & 2.2).
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/19987361-sslsocket-can-t-be-created-from-unixsocket?utm_campaign=plugin&utm_content=tracker%2F136995&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F136995&utm_medium=issues&utm_source=github).
Copying jruby/jruby#2992 here per @headius suggestion, see jruby/jruby#2992 (comment) for rationale.
Testcase:
fails with
on JRuby
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/19987361-sslsocket-can-t-be-created-from-unixsocket?utm_campaign=plugin&utm_content=tracker%2F136995&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F136995&utm_medium=issues&utm_source=github).jruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-05-26 78b009c Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64], no error on MRI (tested with 1.9 & 2.2).