Skip to content

Commit f0f2705

Browse files
committed
[grid] Making DomainSocketsTestBase run
1 parent f569666 commit f0f2705

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

java/test/org/openqa/selenium/remote/internal/DomainSocketsTestBase.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
package org.openqa.selenium.remote.internal;
1919

2020
import com.google.common.net.MediaType;
21+
22+
import org.junit.After;
23+
import org.junit.Before;
24+
import org.junit.Test;
25+
import org.openqa.selenium.remote.http.ClientConfig;
26+
import org.openqa.selenium.remote.http.Contents;
27+
import org.openqa.selenium.remote.http.HttpClient;
28+
import org.openqa.selenium.remote.http.HttpRequest;
29+
import org.openqa.selenium.remote.http.HttpResponse;
30+
import org.openqa.selenium.testing.Safely;
31+
2132
import io.netty.bootstrap.ServerBootstrap;
2233
import io.netty.buffer.ByteBuf;
2334
import io.netty.buffer.PooledByteBufAllocator;
@@ -45,22 +56,14 @@
4556
import io.netty.handler.codec.http.HttpServerCodec;
4657
import io.netty.handler.codec.http.HttpServerKeepAliveHandler;
4758
import io.netty.handler.codec.http.HttpVersion;
48-
import org.junit.After;
49-
import org.junit.Before;
50-
import org.junit.Test;
51-
import org.openqa.selenium.remote.http.ClientConfig;
52-
import org.openqa.selenium.remote.http.Contents;
53-
import org.openqa.selenium.remote.http.HttpClient;
54-
import org.openqa.selenium.remote.http.HttpRequest;
55-
import org.openqa.selenium.remote.http.HttpResponse;
56-
import org.openqa.selenium.testing.Safely;
5759

5860
import java.io.IOException;
5961
import java.net.SocketAddress;
6062
import java.net.URI;
6163
import java.net.URISyntaxException;
6264
import java.nio.file.Files;
6365
import java.nio.file.Path;
66+
import java.nio.file.Paths;
6467
import java.util.concurrent.atomic.AtomicReference;
6568

6669
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
@@ -111,7 +114,9 @@ protected void initChannel(DomainSocketChannel ch) {
111114
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest req) {
112115
byte[] bytes = responseText.get().getBytes(UTF_8);
113116
ByteBuf text = Unpooled.wrappedBuffer(bytes);
114-
FullHttpResponse res = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, text);
117+
FullHttpResponse
118+
res =
119+
new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, text);
115120
res.headers().set(CONTENT_TYPE, MediaType.PLAIN_TEXT_UTF_8.toString());
116121
res.headers().set(CONTENT_LENGTH, bytes.length);
117122

@@ -121,13 +126,13 @@ protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest req) {
121126
}
122127
});
123128

124-
Path temp = Files.createTempFile("domain-socket-test", "socket");
129+
Path temp = Files.createTempFile(Paths.get("/tmp"), "domain-socket-test", "socket");
125130
Files.deleteIfExists(temp);
126131

127132
SocketAddress address = new DomainSocketAddress(temp.toFile());
128133
future = bootstrap.bind(address);
129134

130-
socket = new URI("unix", null, null, 0, temp.toString(), null, null);
135+
this.socket = new URI("unix", null, null, 0, temp.toString(), null, null);
131136
}
132137

133138
@After

0 commit comments

Comments
 (0)