Browse Source

update code

Minh Tùng Trần 2 years ago
parent
commit
9a15fc3282
100 changed files with 945 additions and 0 deletions
  1. BIN
      code/.gradle/7.0/dependencies-accessors/dependencies-accessors.lock
  2. 0 0
      code/.gradle/7.0/dependencies-accessors/gc.properties
  3. BIN
      code/.gradle/7.0/executionHistory/executionHistory.bin
  4. BIN
      code/.gradle/7.0/executionHistory/executionHistory.lock
  5. BIN
      code/.gradle/7.0/fileChanges/last-build.bin
  6. BIN
      code/.gradle/7.0/fileHashes/fileHashes.bin
  7. BIN
      code/.gradle/7.0/fileHashes/fileHashes.lock
  8. 0 0
      code/.gradle/7.0/gc.properties
  9. BIN
      code/.gradle/7.0/javaCompile/classAnalysis.bin
  10. BIN
      code/.gradle/7.0/javaCompile/javaCompile.lock
  11. BIN
      code/.gradle/7.0/javaCompile/taskHistory.bin
  12. BIN
      code/.gradle/buildOutputCleanup/buildOutputCleanup.lock
  13. 2 0
      code/.gradle/buildOutputCleanup/cache.properties
  14. BIN
      code/.gradle/buildOutputCleanup/outputFiles.bin
  15. BIN
      code/.gradle/checksums/checksums.lock
  16. BIN
      code/.gradle/checksums/md5-checksums.bin
  17. BIN
      code/.gradle/checksums/sha1-checksums.bin
  18. 0 0
      code/.gradle/configuration-cache/gc.properties
  19. 0 0
      code/.gradle/vcs-1/gc.properties
  20. 8 0
      code/.idea/.gitignore
  21. 6 0
      code/.idea/compiler.xml
  22. 21 0
      code/.idea/gradle.xml
  23. 20 0
      code/.idea/jarRepositories.xml
  24. 65 0
      code/.idea/libraries-with-intellij-classes.xml
  25. 10 0
      code/.idea/misc.xml
  26. 8 0
      code/.idea/modules.xml
  27. 118 0
      code/.idea/remote-targets.xml
  28. 124 0
      code/.idea/uiDesigner.xml
  29. 33 0
      code/build.gradle
  30. BIN
      code/build/classes/java/main/analyzer/Accuracy$CheckClientTask.class
  31. BIN
      code/build/classes/java/main/analyzer/Accuracy$CheckClientTaskUserKnown.class
  32. BIN
      code/build/classes/java/main/analyzer/Accuracy$CheckHashtagTask.class
  33. BIN
      code/build/classes/java/main/analyzer/Accuracy.class
  34. BIN
      code/build/classes/java/main/analyzer/Analyzer$PointCalculatorTask.class
  35. BIN
      code/build/classes/java/main/analyzer/Analyzer.class
  36. BIN
      code/build/classes/java/main/analyzer/ClientLogParser.class
  37. BIN
      code/build/classes/java/main/analyzer/Counter.class
  38. BIN
      code/build/classes/java/main/analyzer/ServerLogParser.class
  39. BIN
      code/build/classes/java/main/analyzer/models/Client.class
  40. BIN
      code/build/classes/java/main/analyzer/models/Hashtag.class
  41. BIN
      code/build/classes/java/main/analyzer/models/Round.class
  42. BIN
      code/build/classes/java/main/analyzer/models/User.class
  43. BIN
      code/build/classes/java/main/docker/Controller.class
  44. BIN
      code/build/classes/java/main/graph/PopularityLineChart.class
  45. BIN
      code/build/classes/java/main/graph/RoundDataLineChart.class
  46. BIN
      code/build/classes/java/main/parser/DatasetParser$WorkerThread.class
  47. BIN
      code/build/classes/java/main/parser/DatasetParser.class
  48. BIN
      code/build/classes/java/main/parser/Trial$WorkerThread.class
  49. BIN
      code/build/classes/java/main/parser/Trial.class
  50. BIN
      code/build/classes/java/main/proxy/Forwarder.class
  51. BIN
      code/build/classes/java/main/proxy/ProxyServer$ServerThread.class
  52. BIN
      code/build/classes/java/main/proxy/ProxyServer.class
  53. 39 0
      code/build/tmp/compileJava/source-classes-mapping.txt
  54. BIN
      code/gradle/wrapper/gradle-wrapper.jar
  55. 5 0
      code/gradle/wrapper/gradle-wrapper.properties
  56. 89 0
      code/gradlew.bat
  57. 4 0
      code/settings.gradle
  58. BIN
      code/simulation/client/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock
  59. 0 0
      code/simulation/client/.gradle/7.1.1/dependencies-accessors/gc.properties
  60. BIN
      code/simulation/client/.gradle/7.1.1/executionHistory/executionHistory.bin
  61. BIN
      code/simulation/client/.gradle/7.1.1/executionHistory/executionHistory.lock
  62. BIN
      code/simulation/client/.gradle/7.1.1/fileChanges/last-build.bin
  63. BIN
      code/simulation/client/.gradle/7.1.1/fileHashes/fileHashes.bin
  64. BIN
      code/simulation/client/.gradle/7.1.1/fileHashes/fileHashes.lock
  65. 0 0
      code/simulation/client/.gradle/7.1.1/gc.properties
  66. BIN
      code/simulation/client/.gradle/buildOutputCleanup/buildOutputCleanup.lock
  67. 2 0
      code/simulation/client/.gradle/buildOutputCleanup/cache.properties
  68. BIN
      code/simulation/client/.gradle/buildOutputCleanup/outputFiles.bin
  69. BIN
      code/simulation/client/.gradle/checksums/checksums.lock
  70. 0 0
      code/simulation/client/.gradle/vcs-1/gc.properties
  71. 26 0
      code/simulation/client/build.gradle
  72. BIN
      code/simulation/client/build/classes/java/main/client/Client$ClientThread.class
  73. BIN
      code/simulation/client/build/classes/java/main/client/Client.class
  74. BIN
      code/simulation/client/build/libs/client-1.0-SNAPSHOT.jar
  75. BIN
      code/simulation/client/build/tmp/compileJava/previous-compilation-data.bin
  76. 3 0
      code/simulation/client/build/tmp/compileJava/source-classes-mapping.txt
  77. 3 0
      code/simulation/client/build/tmp/jar/MANIFEST.MF
  78. 1 0
      code/simulation/client/settings.gradle
  79. 170 0
      code/simulation/client/src/main/java/client/Client.java
  80. 19 0
      code/simulation/proxy/build.gradle
  81. BIN
      code/simulation/proxy/build/classes/java/main/proxy/Forwarder.class
  82. BIN
      code/simulation/proxy/build/classes/java/main/proxy/ProxyServer$ServerThread.class
  83. BIN
      code/simulation/proxy/build/classes/java/main/proxy/ProxyServer.class
  84. 5 0
      code/simulation/proxy/build/tmp/compileJava/source-classes-mapping.txt
  85. 55 0
      code/simulation/proxy/src/main/java/proxy/Forwarder.java
  86. 81 0
      code/simulation/proxy/src/main/java/proxy/ProxyServer.java
  87. BIN
      code/simulation/server/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock
  88. 0 0
      code/simulation/server/.gradle/7.1.1/dependencies-accessors/gc.properties
  89. BIN
      code/simulation/server/.gradle/7.1.1/executionHistory/executionHistory.bin
  90. BIN
      code/simulation/server/.gradle/7.1.1/executionHistory/executionHistory.lock
  91. BIN
      code/simulation/server/.gradle/7.1.1/fileChanges/last-build.bin
  92. BIN
      code/simulation/server/.gradle/7.1.1/fileHashes/fileHashes.bin
  93. BIN
      code/simulation/server/.gradle/7.1.1/fileHashes/fileHashes.lock
  94. 0 0
      code/simulation/server/.gradle/7.1.1/gc.properties
  95. BIN
      code/simulation/server/.gradle/buildOutputCleanup/buildOutputCleanup.lock
  96. 2 0
      code/simulation/server/.gradle/buildOutputCleanup/cache.properties
  97. BIN
      code/simulation/server/.gradle/buildOutputCleanup/outputFiles.bin
  98. BIN
      code/simulation/server/.gradle/checksums/checksums.lock
  99. 0 0
      code/simulation/server/.gradle/vcs-1/gc.properties
  100. 26 0
      code/simulation/server/build.gradle

BIN
code/.gradle/7.0/dependencies-accessors/dependencies-accessors.lock


+ 0 - 0
code/.gradle/7.0/dependencies-accessors/gc.properties


BIN
code/.gradle/7.0/executionHistory/executionHistory.bin


BIN
code/.gradle/7.0/executionHistory/executionHistory.lock


BIN
code/.gradle/7.0/fileChanges/last-build.bin


BIN
code/.gradle/7.0/fileHashes/fileHashes.bin


BIN
code/.gradle/7.0/fileHashes/fileHashes.lock


+ 0 - 0
code/.gradle/7.0/gc.properties


BIN
code/.gradle/7.0/javaCompile/classAnalysis.bin


BIN
code/.gradle/7.0/javaCompile/javaCompile.lock


BIN
code/.gradle/7.0/javaCompile/taskHistory.bin


BIN
code/.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 2 - 0
code/.gradle/buildOutputCleanup/cache.properties

@@ -0,0 +1,2 @@
+#Wed Jun 09 01:56:44 CEST 2021
+gradle.version=7.0

BIN
code/.gradle/buildOutputCleanup/outputFiles.bin


BIN
code/.gradle/checksums/checksums.lock


BIN
code/.gradle/checksums/md5-checksums.bin


BIN
code/.gradle/checksums/sha1-checksums.bin


+ 0 - 0
code/.gradle/configuration-cache/gc.properties


+ 0 - 0
code/.gradle/vcs-1/gc.properties


+ 8 - 0
code/.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/

+ 6 - 0
code/.idea/compiler.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <bytecodeTargetLevel target="16" />
+  </component>
+</project>

+ 21 - 0
code/.idea/gradle.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="GradleMigrationSettings" migrationVersion="1" />
+  <component name="GradleSettings">
+    <option name="linkedExternalProjectsSettings">
+      <GradleProjectSettings>
+        <option name="distributionType" value="DEFAULT_WRAPPED" />
+        <option name="externalProjectPath" value="$PROJECT_DIR$" />
+        <option name="modules">
+          <set>
+            <option value="$PROJECT_DIR$" />
+            <option value="$PROJECT_DIR$/simulation" />
+            <option value="$PROJECT_DIR$/simulation/client" />
+            <option value="$PROJECT_DIR$/simulation/proxy" />
+            <option value="$PROJECT_DIR$/simulation/server" />
+          </set>
+        </option>
+      </GradleProjectSettings>
+    </option>
+  </component>
+</project>

+ 20 - 0
code/.idea/jarRepositories.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteRepositoriesConfiguration">
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="MavenRepo" />
+      <option name="name" value="MavenRepo" />
+      <option name="url" value="https://repo.maven.apache.org/maven2/" />
+    </remote-repository>
+  </component>
+</project>

+ 65 - 0
code/.idea/libraries-with-intellij-classes.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="libraries-with-intellij-classes">
+    <option name="intellijApiContainingLibraries">
+      <list>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="ideaIU" />
+          <option name="groupId" value="com.jetbrains.intellij.idea" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="ideaIU" />
+          <option name="groupId" value="com.jetbrains" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="ideaIC" />
+          <option name="groupId" value="com.jetbrains.intellij.idea" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="ideaIC" />
+          <option name="groupId" value="com.jetbrains" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="pycharmPY" />
+          <option name="groupId" value="com.jetbrains.intellij.pycharm" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="pycharmPY" />
+          <option name="groupId" value="com.jetbrains" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="pycharmPC" />
+          <option name="groupId" value="com.jetbrains.intellij.pycharm" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="pycharmPC" />
+          <option name="groupId" value="com.jetbrains" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="clion" />
+          <option name="groupId" value="com.jetbrains.intellij.clion" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="clion" />
+          <option name="groupId" value="com.jetbrains" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="riderRD" />
+          <option name="groupId" value="com.jetbrains.intellij.rider" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="riderRD" />
+          <option name="groupId" value="com.jetbrains" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="goland" />
+          <option name="groupId" value="com.jetbrains.intellij.goland" />
+        </LibraryCoordinatesState>
+        <LibraryCoordinatesState>
+          <option name="artifactId" value="goland" />
+          <option name="groupId" value="com.jetbrains" />
+        </LibraryCoordinatesState>
+      </list>
+    </option>
+  </component>
+</project>

+ 10 - 0
code/.idea/misc.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="FrameworkDetectionExcludesConfiguration">
+    <file type="web" url="file://$PROJECT_DIR$" />
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="openjdk-16" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>

+ 8 - 0
code/.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/modules/client.iml" filepath="$PROJECT_DIR$/.idea/modules/client.iml" />
+    </modules>
+  </component>
+</project>

+ 118 - 0
code/.idea/remote-targets.xml

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteTargetsManager">
+    <targets>
+      <target name="socketclient" type="docker">
+        <config>
+          <option name="targetPlatform">
+            <TargetPlatform />
+          </option>
+          <option name="buildImageConfig">
+            <BuildImageConfig>
+              <option name="builtImageTag" value="socketclient" />
+              <option name="dockerFile" value="simulation/client/Dockerfile" />
+            </BuildImageConfig>
+          </option>
+        </config>
+        <ContributedStateBase type="JavaLanguageRuntime">
+          <config>
+            <option name="agentFolder">
+              <VolumeState>
+                <option name="targetSpecificBits">
+                  <map>
+                    <entry key="mountAsVolume" value="false" />
+                  </map>
+                </option>
+              </VolumeState>
+            </option>
+            <option name="classpathFolder">
+              <VolumeState>
+                <option name="targetSpecificBits">
+                  <map>
+                    <entry key="mountAsVolume" value="false" />
+                  </map>
+                </option>
+              </VolumeState>
+            </option>
+            <option name="homePath" value="/usr/java/openjdk-16" />
+            <option name="javaVersionString" value="16.0.1" />
+          </config>
+        </ContributedStateBase>
+      </target>
+      <target name="tcpserver" type="docker">
+        <config>
+          <option name="targetPlatform">
+            <TargetPlatform />
+          </option>
+          <option name="buildImageConfig">
+            <BuildImageConfig>
+              <option name="builtImageTag" value="tcpserver" />
+              <option name="dockerFile" value="simulation/server/Dockerfile" />
+            </BuildImageConfig>
+          </option>
+        </config>
+        <ContributedStateBase type="JavaLanguageRuntime">
+          <config>
+            <option name="agentFolder">
+              <VolumeState>
+                <option name="targetSpecificBits">
+                  <map>
+                    <entry key="mountAsVolume" value="false" />
+                  </map>
+                </option>
+              </VolumeState>
+            </option>
+            <option name="classpathFolder">
+              <VolumeState>
+                <option name="targetSpecificBits">
+                  <map>
+                    <entry key="mountAsVolume" value="false" />
+                  </map>
+                </option>
+              </VolumeState>
+            </option>
+            <option name="homePath" value="/usr/java/openjdk-16" />
+            <option name="javaVersionString" value="16.0.1" />
+          </config>
+        </ContributedStateBase>
+      </target>
+      <target name="proxyserver" type="docker">
+        <config>
+          <option name="targetPlatform">
+            <TargetPlatform />
+          </option>
+          <option name="buildImageConfig">
+            <BuildImageConfig>
+              <option name="builtImageTag" value="proxyserver" />
+              <option name="dockerFile" value="simulation/proxy/Dockerfile" />
+            </BuildImageConfig>
+          </option>
+        </config>
+        <ContributedStateBase type="JavaLanguageRuntime">
+          <config>
+            <option name="agentFolder">
+              <VolumeState>
+                <option name="targetSpecificBits">
+                  <map>
+                    <entry key="mountAsVolume" value="false" />
+                  </map>
+                </option>
+              </VolumeState>
+            </option>
+            <option name="classpathFolder">
+              <VolumeState>
+                <option name="targetSpecificBits">
+                  <map>
+                    <entry key="mountAsVolume" value="false" />
+                  </map>
+                </option>
+              </VolumeState>
+            </option>
+            <option name="homePath" value="/usr/java/openjdk-16" />
+            <option name="javaVersionString" value="16.0.1" />
+          </config>
+        </ContributedStateBase>
+      </target>
+    </targets>
+  </component>
+</project>

+ 124 - 0
code/.idea/uiDesigner.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+      </item>
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+        <initial-values>
+          <property name="text" value="Button" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="RadioButton" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="CheckBox" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="Label" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
+    </group>
+  </component>
+</project>

+ 33 - 0
code/build.gradle

@@ -0,0 +1,33 @@
+plugins {
+    id 'java'
+}
+
+group 'org.example'
+version '1.0-SNAPSHOT'
+
+repositories {
+    mavenCentral()
+}
+
+
+dependencies {
+    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
+    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
+
+    // https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
+    implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
+    implementation group: 'com.github.docker-java', name: 'docker-java', version: '3.2.11'
+    implementation group: 'org.jfree', name: 'jfreechart', version: '1.5.3'
+}
+jar {
+    duplicatesStrategy = DuplicatesStrategy.INCLUDE
+    //manifest {
+    //    attributes 'Main-Class': 'parser.DatasetParser'
+    //}
+    //from {
+    //    configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
+    //}
+}
+test {
+    useJUnitPlatform()
+}

BIN
code/build/classes/java/main/analyzer/Accuracy$CheckClientTask.class


BIN
code/build/classes/java/main/analyzer/Accuracy$CheckClientTaskUserKnown.class


BIN
code/build/classes/java/main/analyzer/Accuracy$CheckHashtagTask.class


BIN
code/build/classes/java/main/analyzer/Accuracy.class


BIN
code/build/classes/java/main/analyzer/Analyzer$PointCalculatorTask.class


BIN
code/build/classes/java/main/analyzer/Analyzer.class


BIN
code/build/classes/java/main/analyzer/ClientLogParser.class


BIN
code/build/classes/java/main/analyzer/Counter.class


BIN
code/build/classes/java/main/analyzer/ServerLogParser.class


BIN
code/build/classes/java/main/analyzer/models/Client.class


BIN
code/build/classes/java/main/analyzer/models/Hashtag.class


BIN
code/build/classes/java/main/analyzer/models/Round.class


BIN
code/build/classes/java/main/analyzer/models/User.class


BIN
code/build/classes/java/main/docker/Controller.class


BIN
code/build/classes/java/main/graph/PopularityLineChart.class


BIN
code/build/classes/java/main/graph/RoundDataLineChart.class


BIN
code/build/classes/java/main/parser/DatasetParser$WorkerThread.class


BIN
code/build/classes/java/main/parser/DatasetParser.class


BIN
code/build/classes/java/main/parser/Trial$WorkerThread.class


BIN
code/build/classes/java/main/parser/Trial.class


BIN
code/build/classes/java/main/proxy/Forwarder.class


BIN
code/build/classes/java/main/proxy/ProxyServer$ServerThread.class


BIN
code/build/classes/java/main/proxy/ProxyServer.class


+ 39 - 0
code/build/tmp/compileJava/source-classes-mapping.txt

@@ -0,0 +1,39 @@
+graph/PopularityLineChart.java
+ graph.PopularityLineChart
+analyzer/models/Round.java
+ analyzer.models.Round
+analyzer/ServerLogParser.java
+ analyzer.ServerLogParser
+analyzer/models/User.java
+ analyzer.models.User
+parser/DatasetParser.java
+ parser.DatasetParser
+ parser.DatasetParser$WorkerThread
+graph/RoundDataLineChart.java
+ graph.RoundDataLineChart
+parser/Trial.java
+ parser.Trial
+ parser.Trial$WorkerThread
+analyzer/Accuracy.java
+ analyzer.Accuracy
+ analyzer.Accuracy$CheckClientTask
+ analyzer.Accuracy$CheckClientTaskUserKnown
+ analyzer.Accuracy$CheckHashtagTask
+analyzer/models/Client.java
+ analyzer.models.Client
+analyzer/Counter.java
+ analyzer.Counter
+analyzer/models/Hashtag.java
+ analyzer.models.Hashtag
+analyzer/Analyzer.java
+ analyzer.Analyzer
+ analyzer.Analyzer$PointCalculatorTask
+analyzer/ClientLogParser.java
+ analyzer.ClientLogParser
+docker/Controller.java
+ docker.Controller
+proxy/Forwarder.java
+ proxy.Forwarder
+proxy/ProxyServer.java
+ proxy.ProxyServer
+ proxy.ProxyServer$ServerThread

BIN
code/gradle/wrapper/gradle-wrapper.jar


+ 5 - 0
code/gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 89 - 0
code/gradlew.bat

@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 4 - 0
code/settings.gradle

@@ -0,0 +1,4 @@
+rootProject.name = 'thesis'
+include 'simulation:client'
+include 'simulation:server'
+include 'simulation:proxy'

BIN
code/simulation/client/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock


+ 0 - 0
code/simulation/client/.gradle/7.1.1/dependencies-accessors/gc.properties


BIN
code/simulation/client/.gradle/7.1.1/executionHistory/executionHistory.bin


BIN
code/simulation/client/.gradle/7.1.1/executionHistory/executionHistory.lock


BIN
code/simulation/client/.gradle/7.1.1/fileChanges/last-build.bin


BIN
code/simulation/client/.gradle/7.1.1/fileHashes/fileHashes.bin


BIN
code/simulation/client/.gradle/7.1.1/fileHashes/fileHashes.lock


+ 0 - 0
code/simulation/client/.gradle/7.1.1/gc.properties


BIN
code/simulation/client/.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 2 - 0
code/simulation/client/.gradle/buildOutputCleanup/cache.properties

@@ -0,0 +1,2 @@
+#Tue Jul 06 21:11:10 CEST 2021
+gradle.version=7.1.1

BIN
code/simulation/client/.gradle/buildOutputCleanup/outputFiles.bin


BIN
code/simulation/client/.gradle/checksums/checksums.lock


+ 0 - 0
code/simulation/client/.gradle/vcs-1/gc.properties


+ 26 - 0
code/simulation/client/build.gradle

@@ -0,0 +1,26 @@
+plugins {
+    id 'java'
+}
+group 'org.example'
+version '1.0-SNAPSHOT'
+repositories {
+    mavenCentral()
+}
+dependencies {
+    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
+    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
+    // https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
+    implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
+}
+jar {
+    duplicatesStrategy = DuplicatesStrategy.INCLUDE
+    manifest {
+        attributes 'Main-Class': 'client.Client'
+    }
+    from {
+        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
+    }
+}
+test {
+    useJUnitPlatform()
+}

BIN
code/simulation/client/build/classes/java/main/client/Client$ClientThread.class


BIN
code/simulation/client/build/classes/java/main/client/Client.class


BIN
code/simulation/client/build/libs/client-1.0-SNAPSHOT.jar


BIN
code/simulation/client/build/tmp/compileJava/previous-compilation-data.bin


+ 3 - 0
code/simulation/client/build/tmp/compileJava/source-classes-mapping.txt

@@ -0,0 +1,3 @@
+client/Client.java
+ client.Client
+ client.Client$ClientThread

+ 3 - 0
code/simulation/client/build/tmp/jar/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: client.Client
+

+ 1 - 0
code/simulation/client/settings.gradle

@@ -0,0 +1 @@
+rootProject.name = 'client'

+ 170 - 0
code/simulation/client/src/main/java/client/Client.java

@@ -0,0 +1,170 @@
+package client;
+
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+public class Client {
+    private Socket socket;
+    private final String proxyHostname = "proxyserver.com";
+    private final InetAddress proxyAddress;
+    private final int serverPort = 1234;
+    private static final String dataPath = "/data/tweets-nov-2012.json.gz.out";
+    private static final String logPath = "/data/logs/";
+    private int lineCount = 0;
+    private volatile int lineDone = 0;
+    private static List<Long> ids = new ArrayList<>();
+
+    private PrintWriter out;
+
+    public static void main(String[] args) throws IOException, InterruptedException, ParseException, ExecutionException {
+        Client c = new Client();
+        c.run();
+    }
+
+    public Client() throws UnknownHostException {
+        proxyAddress = InetAddress.getByName(proxyHostname);
+    }
+
+    void run() throws IOException, InterruptedException, ParseException, ExecutionException {
+        System.out.println("Local Address: " + InetAddress.getLocalHost());
+        // parsing dataset from path
+        int lineTotal = 1150976;
+        FileReader fr = new FileReader(dataPath);
+        BufferedReader br= new BufferedReader(fr);
+        JSONObject obj;
+        String line;
+        this.socket = new Socket(proxyAddress, serverPort);
+        System.out.println("Connected to " + socket.getInetAddress().getHostAddress() + ":" + serverPort);
+        out = new PrintWriter(this.socket.getOutputStream(), true);
+
+        int readProgress = 0;
+
+        long timeDiff = 0L;
+        long startTime = System.currentTimeMillis();
+        Timer timer = new Timer();
+        ExecutorService executor = Executors.newSingleThreadExecutor();
+        List<Future<?>> tasks = new ArrayList<>();
+        while((line = br.readLine()) != null) {
+            lineCount++;
+
+            obj = (JSONObject) new JSONParser().parse(line);
+            long timestamp = Long.parseLong(String.valueOf(obj.get("timestamp")));
+
+            //get first timestamp
+            if(lineCount == 1)
+                timeDiff = startTime - timestamp * 1000;
+
+            //schedule sending message
+            long currentTime = System.currentTimeMillis();
+            long delay = (timestamp * 1000 + timeDiff) - currentTime;
+            if (delay < 0)
+                delay = 0;
+            //timer.schedule(new ClientThread(line), delay);
+            tasks.add(executor.submit(new ClientThread(line)));
+            //count progress
+            if(readProgress != (int)(((double)lineCount/(double)lineTotal) * 100)) {
+                readProgress = (int)(((double)lineCount/(double)lineTotal) * 100);
+                System.out.println(readProgress + "% read");
+            }
+
+            //limit buffer
+            if(lineCount > lineDone + 100)
+                tasks.get(lineCount - 2).get();
+        }
+        // Always close files.
+        br.close();
+        fr.close();
+        for(Future<?> task:tasks) {
+            task.get();
+        }
+        executor.shutdown();
+        socket.close();
+        writeBoundNames();
+    }
+
+    private void writeBoundNames() throws IOException {
+        File file = new File(logPath + "/boundnames.txt");
+        if (file.exists())
+            return;
+
+        FileWriter fw = new FileWriter(file);
+        BufferedWriter bw = new BufferedWriter(fw);
+        for (int i=0; i<ids.size(); i++) {
+            bw.write(ids.get(i) + "\t" + "client-" + i);
+            if(i<ids.size() - 1)
+                bw.newLine();
+        }
+        bw.close();
+    }
+
+    class ClientThread implements Runnable {
+        private final Object lock = new Object();
+        private long id;
+        private long timestamp;
+        private String data;
+        private String clientName;
+
+        ClientThread(String data) throws ParseException {
+            JSONObject obj = (JSONObject) new JSONParser().parse(data);
+            this.timestamp = Long.parseLong(String.valueOf(obj.get("timestamp")));
+            this.id = Long.parseLong(String.valueOf(obj.get("user_id")));
+            this.data = data;
+            this.clientName = getClientName();
+        }
+
+        @Override
+        public void run() {
+            send();
+            log();
+            incrementCount();
+        }
+
+        private void send() {
+            out.write(data + "\n");
+            out.flush();
+            System.out.println(this.clientName + " sends: " + data);
+        }
+
+        private void log() {
+            try {
+                File file = new File(logPath + "/clogs.txt");
+                boolean exists = file.exists();
+                if (!exists) {
+                    file.createNewFile();
+                }
+                FileWriter fw = new FileWriter(file, true);
+                BufferedWriter bw = new BufferedWriter(fw);
+                synchronized (lock) {
+                    if (exists)
+                        bw.newLine();
+                    bw.write(this.clientName + "\t" + socket.getInetAddress().getHostAddress() + "\t" + timestamp);
+                    bw.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        private String getClientName() {
+            int index = ids.indexOf(id);
+            if (index == -1) {
+                ids.add(id);
+                index = ids.size() - 1;
+            }
+            return "client-" + index;
+        }
+
+        private synchronized void incrementCount() {
+            lineDone++;
+        }
+    }
+}

+ 19 - 0
code/simulation/proxy/build.gradle

@@ -0,0 +1,19 @@
+plugins {
+    id 'java'
+}
+
+group 'org.example'
+version '1.0-SNAPSHOT'
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
+    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
+}
+
+test {
+    useJUnitPlatform()
+}

BIN
code/simulation/proxy/build/classes/java/main/proxy/Forwarder.class


BIN
code/simulation/proxy/build/classes/java/main/proxy/ProxyServer$ServerThread.class


BIN
code/simulation/proxy/build/classes/java/main/proxy/ProxyServer.class


+ 5 - 0
code/simulation/proxy/build/tmp/compileJava/source-classes-mapping.txt

@@ -0,0 +1,5 @@
+proxy/Forwarder.java
+ proxy.Forwarder
+proxy/ProxyServer.java
+ proxy.ProxyServer
+ proxy.ProxyServer$ServerThread

+ 55 - 0
code/simulation/proxy/src/main/java/proxy/Forwarder.java

@@ -0,0 +1,55 @@
+package proxy;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.InetAddress;
+import java.net.Socket;
+
+public class Forwarder {
+    private Socket socket = null;
+    public static boolean forwarderReady = false;
+    private PrintWriter out;
+
+    protected Forwarder(InetAddress serverAddress, int serverPort) throws IOException, InterruptedException {
+        try {
+            bindSocket(serverAddress, serverPort);
+        } catch (Exception e) {
+            System.out.println("Retrying...");
+            Thread.sleep(5000);
+            bindSocket(serverAddress, serverPort);
+        }
+    }
+
+    private void bindSocket(InetAddress serverAddress, int serverPort) throws IOException {
+        this.socket = new Socket(serverAddress, serverPort);
+        while(!socket.isBound()) ;
+        forwarderReady = true;
+        out = new PrintWriter(this.socket.getOutputStream(), true);
+        System.out.println("Connected to " + serverAddress.getHostAddress() + ":" + serverPort);
+    }
+
+    protected void forward() {
+        System.out.println("Round ends. Forwarding...");
+        StringBuilder messages = new StringBuilder();
+        synchronized (ProxyServer.MSGs) {
+            if(ProxyServer.MSGs.isEmpty())
+                return;
+            while (!ProxyServer.MSGs.isEmpty()) {
+                out.write(ProxyServer.MSGs.remove(0) +"\n");
+                out.flush();
+            }
+        }
+
+        //System.out.println("Active closing");
+        //this.socket.close();
+    }
+
+    protected void forwardDirectly(String data) {
+        out.write(data+"\n");
+        out.flush();
+
+        //System.out.println("Active closing");
+        //this.socket.close();
+    }
+
+}

+ 81 - 0
code/simulation/proxy/src/main/java/proxy/ProxyServer.java

@@ -0,0 +1,81 @@
+package proxy;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.net.InetAddress;
+
+public class ProxyServer {
+    public static List<String> MSGs = new ArrayList<>();
+    private static final int PORT = 1234;
+    private static final int roundLength = 3600; //secs
+    private ServerSocket server;
+    private Forwarder f;
+
+    public static void main(String[] args) throws IOException, InterruptedException {
+        //start a thread for a forwarder
+        ProxyServer ps = new ProxyServer();
+        ps.run();
+    }
+
+    public ProxyServer() throws IOException, InterruptedException {
+        server = new ServerSocket(PORT, 1, InetAddress.getLocalHost());
+        f = new Forwarder(InetAddress.getByName("tcpserver.com"), 2345);
+        System.out.println("\r\nRunning Server: " + "Host=" + server.getInetAddress().getHostAddress() + " Port=" + server.getLocalPort() + " Hostname=" + server.getInetAddress().getHostName());
+    }
+
+    void run() throws IOException {
+        //Thread t = new Thread(() -> {
+        //    try {
+        //        Forwarder f = new Forwarder(InetAddress.getByName("tcpserver.com"), 2345);
+        //        while (true) {
+        //            f.forward();
+        //            Thread.sleep(1000);
+        //        }
+        //    } catch (Exception e) {
+        //        e.printStackTrace();
+        //    }
+        //});
+        //t.start();
+        ExecutorService executor = Executors.newCachedThreadPool();
+        while (true) {
+            //this will block until a connection is made
+            Socket client = this.server.accept();
+            executor.execute(new ServerThread(client));
+        }
+    }
+
+    private class ServerThread implements Runnable {
+        private Socket client;
+
+        public ServerThread(Socket client) {
+            this.client = client;
+            System.out.println("New connection from " + client.getInetAddress().getHostAddress());
+        }
+
+        @Override
+        public void run() {
+            try {
+                listen();
+                this.client.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        void listen() throws IOException {
+            BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
+            String data = null;
+            while((data = in.readLine()) != null) {
+                //MSGs.add(data);
+                f.forwardDirectly(data);
+                System.out.println(client.getInetAddress().getHostAddress() + ": " + data);
+            }
+        }
+    }
+}

BIN
code/simulation/server/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock


+ 0 - 0
code/simulation/server/.gradle/7.1.1/dependencies-accessors/gc.properties


BIN
code/simulation/server/.gradle/7.1.1/executionHistory/executionHistory.bin


BIN
code/simulation/server/.gradle/7.1.1/executionHistory/executionHistory.lock


BIN
code/simulation/server/.gradle/7.1.1/fileChanges/last-build.bin


BIN
code/simulation/server/.gradle/7.1.1/fileHashes/fileHashes.bin


BIN
code/simulation/server/.gradle/7.1.1/fileHashes/fileHashes.lock


+ 0 - 0
code/simulation/server/.gradle/7.1.1/gc.properties


BIN
code/simulation/server/.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 2 - 0
code/simulation/server/.gradle/buildOutputCleanup/cache.properties

@@ -0,0 +1,2 @@
+#Wed Jul 07 13:22:01 CEST 2021
+gradle.version=7.1.1

BIN
code/simulation/server/.gradle/buildOutputCleanup/outputFiles.bin


BIN
code/simulation/server/.gradle/checksums/checksums.lock


+ 0 - 0
code/simulation/server/.gradle/vcs-1/gc.properties


+ 26 - 0
code/simulation/server/build.gradle

@@ -0,0 +1,26 @@
+plugins {
+    id 'java'
+}
+group 'org.example'
+version '1.0-SNAPSHOT'
+repositories {
+    mavenCentral()
+}
+dependencies {
+    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
+    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
+    // https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
+    implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
+}
+jar {
+    duplicatesStrategy = DuplicatesStrategy.INCLUDE
+    manifest {
+        attributes 'Main-Class': 'server.TCPServer'
+    }
+    from {
+        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
+    }
+}
+test {
+    useJUnitPlatform()
+}

Some files were not shown because too many files changed in this diff