Make NamedPipeSocket.connect a no-op to fix connection exceptions

Update `NamedPipeSocket` so that `connect` methods are now no-ops. This
restores the behavior of Spring Boot 3.3 which previously handled the
case by overriding `ConnectionSocketFactory.connectSocket`. The newer
HTTP client code uses the `DetachedSocketFactory` interface which
doesn't offer a method that we can override, so instead we must change
the socket implementation itself.

Fixes gh-42952
This commit is contained in:
Phillip Webb 2024-11-01 13:22:07 -07:00
parent bc5a25bf16
commit 2fa1180332
1 changed files with 11 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousByteChannel;
import java.nio.channels.AsynchronousCloseException;
@ -73,6 +74,16 @@ public class NamedPipeSocket extends Socket {
}
}
@Override
public void connect(SocketAddress endpoint) throws IOException {
// No-op
}
@Override
public void connect(SocketAddress endpoint, int timeout) throws IOException {
// No-op
}
@Override
public InputStream getInputStream() {
return Channels.newInputStream(this.channel);