Sockets moved to core-java
This commit is contained in:
parent
bfddf3344d
commit
4670b8dbda
@ -18,3 +18,4 @@
|
|||||||
- [MD5 Hashing in Java](http://www.baeldung.com/java-md5)
|
- [MD5 Hashing in Java](http://www.baeldung.com/java-md5)
|
||||||
- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist)
|
- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist)
|
||||||
- [Guide to Java Reflection](http://www.baeldung.com/java-reflection)
|
- [Guide to Java Reflection](http://www.baeldung.com/java-reflection)
|
||||||
|
- [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets)
|
||||||
|
@ -46,7 +46,7 @@ public class EchoMultiServer {
|
|||||||
clientSocket.getInputStream()));
|
clientSocket.getInputStream()));
|
||||||
String inputLine;
|
String inputLine;
|
||||||
while ((inputLine = in.readLine()) != null) {
|
while ((inputLine = in.readLine()) != null) {
|
||||||
if (".".equals(inputLine)) {
|
if ("".equals(inputLine)) {
|
||||||
out.println("bye");
|
out.println("bye");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ public class EchoServer {
|
|||||||
clientSocket.getInputStream()));
|
clientSocket.getInputStream()));
|
||||||
String inputLine;
|
String inputLine;
|
||||||
while ((inputLine = in.readLine()) != null) {
|
while ((inputLine = in.readLine()) != null) {
|
||||||
if (".".equals(inputLine)) {
|
if ("".equals(inputLine)) {
|
||||||
out.println("good bye");
|
out.println("good bye");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ public class EchoMultiTest {
|
|||||||
client.startConnection("127.0.0.1", 5555);
|
client.startConnection("127.0.0.1", 5555);
|
||||||
String msg1 = client.sendMessage("hello");
|
String msg1 = client.sendMessage("hello");
|
||||||
String msg2 = client.sendMessage("world");
|
String msg2 = client.sendMessage("world");
|
||||||
String terminate = client.sendMessage(".");
|
String terminate = client.sendMessage("");
|
||||||
assertEquals(msg1, "hello");
|
assertEquals(msg1, "hello");
|
||||||
assertEquals(msg2, "world");
|
assertEquals(msg2, "world");
|
||||||
assertEquals(terminate, "bye");
|
assertEquals(terminate, "bye");
|
||||||
@ -34,7 +34,7 @@ public class EchoMultiTest {
|
|||||||
client.startConnection("127.0.0.1", 5555);
|
client.startConnection("127.0.0.1", 5555);
|
||||||
String msg1 = client.sendMessage("hello");
|
String msg1 = client.sendMessage("hello");
|
||||||
String msg2 = client.sendMessage("world");
|
String msg2 = client.sendMessage("world");
|
||||||
String terminate = client.sendMessage(".");
|
String terminate = client.sendMessage("");
|
||||||
assertEquals(msg1, "hello");
|
assertEquals(msg1, "hello");
|
||||||
assertEquals(msg2, "world");
|
assertEquals(msg2, "world");
|
||||||
assertEquals(terminate, "bye");
|
assertEquals(terminate, "bye");
|
||||||
@ -47,7 +47,7 @@ public class EchoMultiTest {
|
|||||||
client.startConnection("127.0.0.1", 5555);
|
client.startConnection("127.0.0.1", 5555);
|
||||||
String msg1 = client.sendMessage("hello");
|
String msg1 = client.sendMessage("hello");
|
||||||
String msg2 = client.sendMessage("world");
|
String msg2 = client.sendMessage("world");
|
||||||
String terminate = client.sendMessage(".");
|
String terminate = client.sendMessage("");
|
||||||
assertEquals(msg1, "hello");
|
assertEquals(msg1, "hello");
|
||||||
assertEquals(msg2, "world");
|
assertEquals(msg2, "world");
|
||||||
assertEquals(terminate, "bye");
|
assertEquals(terminate, "bye");
|
@ -26,7 +26,7 @@ public class EchoTest {
|
|||||||
String resp1 = client.sendMessage("hello");
|
String resp1 = client.sendMessage("hello");
|
||||||
String resp2 = client.sendMessage("world");
|
String resp2 = client.sendMessage("world");
|
||||||
String resp3 = client.sendMessage("!");
|
String resp3 = client.sendMessage("!");
|
||||||
String resp4 = client.sendMessage(".");
|
String resp4 = client.sendMessage("");
|
||||||
assertEquals("hello", resp1);
|
assertEquals("hello", resp1);
|
||||||
assertEquals("world", resp2);
|
assertEquals("world", resp2);
|
||||||
assertEquals("!", resp3);
|
assertEquals("!", resp3);
|
@ -1,2 +0,0 @@
|
|||||||
### Relevant Articles:
|
|
||||||
- [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets)
|
|
@ -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>
|
|
Loading…
x
Reference in New Issue
Block a user