Get account name WS

master
Henry Varona 2016-11-26 18:45:36 -04:00
parent 8a5c7e51a4
commit f8d07ccc64
3 changed files with 3 additions and 8 deletions

View File

@ -64,7 +64,6 @@ public class Address {
factory.setSSLContext(context);
WebSocket mWebSocket = factory.createSocket(OPENLEDGER_WITNESS_URL);
mWebSocket.addListener(new GetAccountsByAddress(this.toString(), accountIdListener));
System.out.println("Before connecting");
mWebSocket.connect();
} catch (IOException e) {
System.out.println("IOException. Msg: " + e.getMessage());
@ -95,11 +94,9 @@ public class Address {
if (sl.size() > 0) {
accountId = (String) sl.get(0);
try {
// Create a custom SSL context.
SSLContext context = NaiveSSLContext.getInstance("TLS");
WebSocketFactory factory = new WebSocketFactory();
factory.setSSLContext(context);
WebSocket mWebSocket = factory.createSocket(OPENLEDGER_WITNESS_URL);
mWebSocket.addListener(new GetAccountNameById(accountId, accountListener));
mWebSocket.connect();
@ -139,7 +136,6 @@ public class Address {
if (response.result.getClass() == ArrayList.class) {
List l = (List) response.result;
if (l.size() > 0) {
System.out.println("list class " + l.get(0).getClass());
if (l.get(0).getClass() == LinkedTreeMap.class) {
LinkedTreeMap ltm = (LinkedTreeMap) l.get(0);
accountName = (String) ltm.get("name");

View File

@ -606,8 +606,9 @@ public class Test {
public void testAccountNamebyAddress() {
BrainKey brainKey = new BrainKey(Main.BRAIN_KEY, 0);
Address address = new Address(brainKey.getPrivateKey());
address.getAccountName();
Address address = new Address(brainKey.getPrivateKey());
address.getAccountDetail();
System.out.println(address.getAccountName());
/*try {
BrainKey brainKey = new BrainKey(Main.BRAIN_KEY, 0);
Address address = new Address(brainKey.getPrivateKey());

View File

@ -77,7 +77,6 @@ public class ApiCall implements JsonSerializable {
methodParams.add((String) this.params.get(i));
}else if(this.params.get(i) instanceof ArrayList){
// Other times it might be an array
System.out.println("es un arreglo");
JsonArray array = new JsonArray();
ArrayList<JsonSerializable> listArgument = (ArrayList<JsonSerializable>) this.params.get(i);
for(int l = 0; l < listArgument.size(); l++){
@ -90,7 +89,6 @@ public class ApiCall implements JsonSerializable {
paramsArray.add(methodParams);
obj.add(KEY_PARAMS, paramsArray);
obj.addProperty(KEY_JSON_RPC, this.jsonrpc);
System.out.println("JSON Object: " + obj.toString());
return obj;
}