SessionTrafficResult { public static SessionTrafficResult parseFromArray(Object[] objects) { if(!(objects[0] instanceof Long) || !(objects[1] instanceof Long) || !(objects[2] instanceof Long)) { throw new XpipeRuntimeException("first element of SocketStatsResult should be timestamp"); } long timestamp = (long) objects[0]; long inputBytes = (long) objects[1]; long outputBytes = (long) objects[2]; long inputRates = (long) objects[3]; long outputRates = (long) objects[4]; return new SessionTrafficResult(timestamp, inputBytes, outputBytes, inputRates, outputRates); } SessionTrafficResult(long timestamp, long inputBytes, long outputBytes, long inputRates, long outputRates); Object[] toArray(); static SessionTrafficResult parseFromArray(Object[] objects); long getTimestamp(); long getInputBytes(); long getOutputBytes(); long getInputRates(); long getOutputRates(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void parseFromArray() { long timestamp = System.currentTimeMillis(); long input = 1000, output = 2000, inputRates = 10, outputRates = 20; result = new SessionTrafficResult(timestamp, input, output, inputRates, outputRates); Object[] objects = result.toArray(); SessionTrafficResult other = SessionTrafficResult.parseFromArray(objects); Assert.assertEquals(result, other); }