Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into main
  • Loading branch information
adamsk4 committed Dec 15, 2022
2 parents 0233b4f + 268939e commit b45e81c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ public void run() {

// execute valid response to engine
Response response = producer.send(tag, sub_tag, data);
out.writeUTF(new JSONObject()
.put("response", "200")
.put("code", response.code())
.put("message", response.message())
.put("data", response.data())
.toString());
out.flush();
System.out.println("<<<responded>>>");
// out.writeUTF(new JSONObject()
// .put("response", "200")
// .put("code", response.code())
// .put("message", response.message())
// .put("data", response.data())
// .toString());
// out.flush();

} catch(Exception e) {
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ public class Config {
private static final HashMap<String, Properties> properties;

static {
// properties = new HashMap<String, Properties>();
//
// String[] files = new File("src/main/resources/config").list();
//
// for(String file : files) {
// if(file.lastIndexOf(".properties") == file.length() - 11) {
// String name = file.substring(0, file.length() - 11);
// properties.put(name, new Properties());
//
// try (FileInputStream in = new FileInputStream("src/main/resources/config/" + file)) {
// properties.get(name).load(in);
// } catch(Exception e) {
// e.printStackTrace();
// System.exit(1);
// }
// }
// }

properties = new HashMap<String, Properties>();

Properties app_properties = new Properties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ public class Config {
private static final HashMap<String, Properties> properties;

static {
// properties = new HashMap<String, Properties>();
//
// String[] files = new File("config").list();
//
// for(String file : files) {
// if(file.lastIndexOf(".properties") == file.length() - 11) {
// String name = file.substring(0, file.length() - 11);
// properties.put(name, new Properties());
//
// try (FileInputStream in = new FileInputStream("config/" + file)) {
// properties.get(name).load(in);
// } catch(Exception e) {
// e.printStackTrace();
// System.exit(1);
// }
// }
// }

properties = new HashMap<String, Properties>();

Properties app_properties = new Properties();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package test.connection.socket;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
Expand All @@ -16,7 +15,8 @@

public class LocalTest {

private static final String host = "localhost";
//private static final String host = "localhost";
private static final String host = "defi-de.idea.rpi.edu";

public static void main(String[] args) throws UnknownHostException, IOException {
final Socket socket = SocketFactory.getDefault().createSocket(host, 61200);
Expand All @@ -38,14 +38,14 @@ public static void main(String[] args) throws UnknownHostException, IOException
+ "destination&&&%s&&&"
+ "key&&&%s&&&"
+ "start_date&&&2022-08-01&&&"
+ "end_date&&&2022-08-02&&&"
+ "end_date&&&2022-09-01&&&"
+ "query&&&aave-protocol-dated&&&"
+ "request&&&aave-protocol-dated\n",
destination,
key));

while(true) {
System.out.print(readLine(in));
System.out.println(readLine(in));
}

// String rqst_protocol_dated = String.format("http://%s:8080/defi/v1/rest/request_dated?"
Expand Down Expand Up @@ -79,6 +79,7 @@ public static void main(String[] args) throws UnknownHostException, IOException
}

public static String request(String str) throws IOException {
System.out.println(str);
URL obj = new URL(str);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
Expand All @@ -105,8 +106,9 @@ public static String request(String str) throws IOException {
public static final String readLine(BufferedReader in) throws IOException {
StringBuilder out = new StringBuilder();
char c = 0;
while((c = (char)in.read()) != 10)
while((c = (char)in.read()) != 10) {
out.append(c);
}

return out.toString();
}
Expand Down

0 comments on commit b45e81c

Please sign in to comment.