1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.classic.net.server;
15
16 import javax.net.ServerSocketFactory;
17
18 import org.junit.jupiter.api.BeforeEach;
19
20 import ch.qos.logback.core.net.mock.MockContext;
21 import org.junit.jupiter.api.Test;
22
23 import static org.junit.jupiter.api.Assertions.assertNotNull;
24 import static org.junit.jupiter.api.Assertions.assertTrue;
25
26
27
28
29
30
31 public class SSLServerSocketReceiverTest {
32
33 private MockContext context = new MockContext();
34
35 private MockSSLConfiguration ssl = new MockSSLConfiguration();
36
37 private MockSSLParametersConfiguration parameters = new MockSSLParametersConfiguration();
38
39 private SSLServerSocketReceiver receiver = new SSLServerSocketReceiver();
40
41 @BeforeEach
42 public void setUp() throws Exception {
43 receiver.setContext(context);
44 receiver.setSsl(ssl);
45 ssl.setParameters(parameters);
46 }
47
48 @Test
49 public void testGetServerSocketFactory() throws Exception {
50 ServerSocketFactory socketFactory = receiver.getServerSocketFactory();
51 assertNotNull(socketFactory);
52 assertTrue(ssl.isContextCreated());
53 assertTrue(parameters.isContextInjected());
54 }
55
56 }