1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.testsuite.transport.socket;
17
18 import io.netty.bootstrap.ServerBootstrap;
19 import io.netty.buffer.ByteBufAllocator;
20 import io.netty.channel.ChannelOption;
21 import io.netty.testsuite.transport.AbstractTestsuiteTest;
22 import io.netty.testsuite.transport.TestsuitePermutation;
23 import io.netty.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, ByteBufAllocator allocator) {
38 bootstrap.localAddress(newSocketAddress());
39 bootstrap.option(ChannelOption.ALLOCATOR, allocator);
40 bootstrap.childOption(ChannelOption.ALLOCATOR, allocator);
41 }
42
43 protected SocketAddress newSocketAddress() {
44 return new InetSocketAddress(
45 NetUtil.LOCALHOST, 0);
46 }
47 }