01 /*
02 * Created on Jul 3, 2004
03 *
04 * To change the template for this generated file go to
05 * Window - Preferences - Java - Code Generation - Code and Comments
06 */
07 package biz.xsoftware.examples.socket;
08
09 import java.io.IOException;
10 import java.nio.ByteBuffer;
11
12 /**
13 * SysUnderTest that uses TCPSockets to talk to a server.
14 *
15 * @author Dean Hiller
16 */
17 public class SysUnderTest {
18
19 private TCPSocket s;
20 private OtherSubsystem userService;
21
22 /**
23 * @showcode
24 */
25 public SysUnderTest(TCPSocket s, OtherSubsystem userSvc) {
26 this.s = s;
27 this.userService = userSvc;
28 }
29
30 /**
31 * @showcode
32 */
33 public void sendUserToServer(int id) {
34 ByteBuffer userData = userService.getUserData(id);
35
36 try {
37 s.write(userData);
38 } catch(IOException e) {
39 userService.failedToSendUser(id);
40 }
41 }
42 }
|