Skip to content

Commit

Permalink
Make NamedPipeSocket.connect a no-op to fix connection exceptions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
philwebb committed Nov 1, 2024
1 parent bc5a25b commit 2fa1180
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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;
Expand Down Expand Up @@ -73,6 +74,16 @@ private AsynchronousFileByteChannel open(String path) throws IOException {
}
}

@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);
Expand Down

0 comments on commit 2fa1180

Please sign in to comment.