1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.testsuite.transport.socket;
17
18 import io.netty5.bootstrap.ServerBootstrap;
19 import io.netty5.buffer.api.BufferAllocator;
20 import io.netty5.channel.ChannelOption;
21 import io.netty5.testsuite.transport.AbstractTestsuiteTest;
22 import io.netty5.testsuite.transport.TestsuitePermutation;
23 import io.netty5.util.NetUtil;
24
25 import java.net.InetSocketAddress;
26 import java.net.SocketAddress;
27 import java.util.List;
28
29 public abstract class AbstractServerSocketTest extends AbstractTestsuiteTest<ServerBootstrap> {
30
31 @Override
32 protected List<TestsuitePermutation.BootstrapFactory<ServerBootstrap>> newFactories() {
33 return SocketTestPermutation.INSTANCE.serverSocket();
34 }
35
36 @Override
37 protected void configure(ServerBootstrap bootstrap,
38 BufferAllocator bufferAllocator) {
39 bootstrap.localAddress(newSocketAddress());
40 bootstrap.option(ChannelOption.BUFFER_ALLOCATOR, bufferAllocator);
41 bootstrap.childOption(ChannelOption.BUFFER_ALLOCATOR, bufferAllocator);
42 }
43
44 protected SocketAddress newSocketAddress() {
45 return new InetSocketAddress(NetUtil.LOCALHOST, 0);
46 }
47 }