Refactor examples

This commit is contained in:
Grzegorz Piwowarek
2016-10-23 11:57:11 +02:00
parent 8031458265
commit 65daa3aee2
6 changed files with 8 additions and 10 deletions

View File

@@ -23,8 +23,7 @@ public class EchoClient {
public String sendMessage(String msg) {
try {
out.println(msg);
String resp = in.readLine();
return resp;
return in.readLine();
} catch (Exception e) {
return null;
}

View File

@@ -46,7 +46,7 @@ public class EchoMultiServer {
clientSocket.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
if ("".equals(inputLine)) {
if (".".equals(inputLine)) {
out.println("bye");
break;
}

View File

@@ -18,7 +18,7 @@ public class EchoServer {
clientSocket.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
if ("".equals(inputLine)) {
if (".".equals(inputLine)) {
out.println("good bye");
break;
}

View File

@@ -26,8 +26,7 @@ public class GreetClient {
public String sendMessage(String msg) {
try {
out.println(msg);
String resp = in.readLine();
return resp;
return in.readLine();
} catch (Exception e) {
return null;
}