()
| 31 | } |
| 32 | |
| 33 | public void run() { |
| 34 | Socket socketFromServer = null; |
| 35 | try { |
| 36 | socketFromServer = new Socket(inetaServer, iPort); |
| 37 | BufferedReader in = new BufferedReader(new InputStreamReader(socketFromServer.getInputStream())); |
| 38 | OutputStream out = socketFromServer.getOutputStream(); |
| 39 | |
| 40 | byte[] bytesOut = GREETING.getBytes(); |
| 41 | String strIn = GREETING.trim(); |
| 42 | for(int i = 0; i < iIterations; ++i) { |
| 43 | out.write(bytesOut); |
| 44 | out.flush(); |
| 45 | String strRead = in.readLine(); |
| 46 | if(!strRead.equals(strIn)) |
| 47 | throw new RuntimeException("client: \"" + strIn + "\" ne \"" + strRead + "\""); |
| 48 | } |
| 49 | } catch(Exception e) { |
| 50 | e.printStackTrace(); |
| 51 | } |
| 52 | |
| 53 | try { |
| 54 | socketFromServer.close(); |
| 55 | } catch(Exception e) { } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | class EchoServer extends Thread { |
nothing calls this directly
no test coverage detected