1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.core.net.server;
15
16
17
18
19
20
21
22
23 class MockClient implements Client {
24
25 private boolean running;
26 private boolean closed;
27
28 public void run() {
29 synchronized (this) {
30 running = true;
31 notifyAll();
32 while (running && !Thread.currentThread().isInterrupted()) {
33 try {
34 wait();
35 } catch (InterruptedException ex) {
36 Thread.currentThread().interrupt();
37 }
38 }
39 }
40 }
41
42 public void close() {
43 synchronized (this) {
44 running = false;
45 closed = true;
46 notifyAll();
47 }
48 }
49
50 public synchronized boolean isRunning() {
51 return running;
52 }
53
54 public synchronized boolean isClosed() {
55 return closed;
56 }
57
58 }