Closed slinkydeveloper closed 3 years ago
I use the AFUNIXSocket
in a custom Socket
like this: https://github.com/docker-client/docker-filesocket/blob/a03c2238fa40f20be86fac72e6edf668a314b8c4/src/main/java/de/gesellix/docker/client/filesocket/UnixSocket.java#L36
Maybe that code gives you some inspiration.
Also have had a similar issue (jdk 11.0.8):
java.net.SocketException: already connected
at java.base/java.net.Socket.connect(Socket.java:589)
at my.package.UnixSocketWrapper.connect(TunnelingUnixSocket.kt:<line_number>)
at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:117)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:266)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:180)
but at the same time curl --unix-socket ...
worked as expected. The solution pointed by @gesellix resolved the problem for me.
Thanks for reporting! This should be fixed in 2.4.0 (just released)
Hi, I'm trying to use junixsocket in conjunction with okhttp3 (3.14.6) to use HTTP over UDS.
I'm trying something like:
And then i use this address to perform the request:
But as soon as i try to perform a request i get this:
Trying to debug it, I've found that the unix socket factory
AFUNIXSocketFactory.FactoryArg
is never invoked, because okhttp uses always theSocketFactory
methodSocket createSocket()
which doesn't set the sockFile I've provided as parameter ofAFUNIXSocketFactory.FactoryArg
. I've tried to search a workaround implementing manually a SocketFactory, but i didn't managed to make it working.Any hints?