-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.warnermedia.kplserver; | ||
|
||
public class MinimalKey { | ||
String kdsHashKey = null; | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/warnermedia/kplserver/TestClientJSONKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.warnermedia.kplserver; | ||
|
||
import com.google.gson.Gson; | ||
|
||
import java.io.*; | ||
import java.net.Socket; | ||
|
||
|
||
public class TestClientJSONKey { | ||
public static class TestWithKey { | ||
String kdsHashKey; | ||
String testa; | ||
} | ||
|
||
public static void main(String[] args) throws Exception, IOException, ClassNotFoundException, InterruptedException { | ||
|
||
System.out.println("starting client"); | ||
|
||
// establish socket connection to server | ||
Socket socket = new Socket("127.0.0.1", 3000); | ||
OutputStreamWriter out = new OutputStreamWriter(socket.getOutputStream(), "UTF-8"); | ||
|
||
System.out.println("Sending request to Socket Server"); | ||
|
||
TestWithKey tst = new TestWithKey(); | ||
tst.kdsHashKey = "mykey"; | ||
tst.testa ="hello"; | ||
|
||
Gson gson = new Gson(); | ||
String jsonResult = gson.toJson(tst); | ||
String jsonFinal = jsonResult + "\n"; | ||
|
||
out.write(jsonFinal); | ||
out.flush(); | ||
Thread.sleep(100); | ||
|
||
socket.close(); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/warnermedia/kplserver/TestClientJSONNoKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.warnermedia.kplserver; | ||
|
||
import com.google.gson.Gson; | ||
|
||
import java.io.*; | ||
import java.net.Socket; | ||
|
||
|
||
public class TestClientJSONNoKey { | ||
public static class TestWithNoKey { | ||
String testa; | ||
} | ||
|
||
public static void main(String[] args) throws Exception, IOException, ClassNotFoundException, InterruptedException { | ||
|
||
System.out.println("starting client"); | ||
|
||
// establish socket connection to server | ||
Socket socket = new Socket("127.0.0.1", 3000); | ||
OutputStreamWriter out = new OutputStreamWriter(socket.getOutputStream(), "UTF-8"); | ||
|
||
System.out.println("Sending request to Socket Server"); | ||
|
||
TestWithNoKey tst = new TestWithNoKey(); | ||
tst.testa ="hello"; | ||
|
||
Gson gson = new Gson(); | ||
String jsonResult = gson.toJson(tst); | ||
String jsonFinal = jsonResult + "\n"; | ||
|
||
out.write(jsonFinal); | ||
out.flush(); | ||
Thread.sleep(100); | ||
|
||
socket.close(); | ||
} | ||
} |