Sockets moved to core-java

This commit is contained in:
Grzegorz Piwowarek 2016-10-23 11:25:09 +02:00
parent bfddf3344d
commit 4670b8dbda
11 changed files with 7 additions and 38 deletions

View File

@ -18,3 +18,4 @@
- [MD5 Hashing in Java](http://www.baeldung.com/java-md5)
- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist)
- [Guide to Java Reflection](http://www.baeldung.com/java-reflection)
- [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets)

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

@ -21,7 +21,7 @@ public class EchoMultiTest {
client.startConnection("127.0.0.1", 5555);
String msg1 = client.sendMessage("hello");
String msg2 = client.sendMessage("world");
String terminate = client.sendMessage(".");
String terminate = client.sendMessage("");
assertEquals(msg1, "hello");
assertEquals(msg2, "world");
assertEquals(terminate, "bye");
@ -34,7 +34,7 @@ public class EchoMultiTest {
client.startConnection("127.0.0.1", 5555);
String msg1 = client.sendMessage("hello");
String msg2 = client.sendMessage("world");
String terminate = client.sendMessage(".");
String terminate = client.sendMessage("");
assertEquals(msg1, "hello");
assertEquals(msg2, "world");
assertEquals(terminate, "bye");
@ -47,7 +47,7 @@ public class EchoMultiTest {
client.startConnection("127.0.0.1", 5555);
String msg1 = client.sendMessage("hello");
String msg2 = client.sendMessage("world");
String terminate = client.sendMessage(".");
String terminate = client.sendMessage("");
assertEquals(msg1, "hello");
assertEquals(msg2, "world");
assertEquals(terminate, "bye");

View File

@ -26,7 +26,7 @@ public class EchoTest {
String resp1 = client.sendMessage("hello");
String resp2 = client.sendMessage("world");
String resp3 = client.sendMessage("!");
String resp4 = client.sendMessage(".");
String resp4 = client.sendMessage("");
assertEquals("hello", resp1);
assertEquals("world", resp2);
assertEquals("!", resp3);

View File

@ -1,2 +0,0 @@
### Relevant Articles:
- [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets)

View File

@ -1,30 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>sockets</artifactId>
<version>1.0</version>
<name>sockets</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>