ChangeServerRandomAction extends ConnectionBoundAction { @Override public void execute(State state) throws WorkflowExecutionException { TlsContext tlsContext = state.getTlsContext(getConnectionAlias()); if (isExecuted()) { throw new WorkflowExecutionException("Action already executed!"); } oldValue = tlsContext.getServerRandom(); tlsContext.setServerRandom(newValue); LOGGER.info("Changed ServerRandom from " + ArrayConverter.bytesToHexString(oldValue) + " to " + ArrayConverter.bytesToHexString(newValue)); setExecuted(true); } ChangeServerRandomAction(byte[] newValue);  ChangeServerRandomAction(); void setNewValue(byte[] newValue); byte[] getNewValue(); byte[] getOldValue(); @Override void execute(State state); @Override void reset(); @Override int hashCode(); @Override boolean equals(Object obj); @Override boolean executedAsPlanned();  }
@Test public void testExecute() { tlsContext.setServerRandom(new byte[] { 3 }); action.execute(state); assertArrayEquals(action.getOldValue(), new byte[] { 3 }); assertArrayEquals(action.getNewValue(), new byte[] { 0, 1 }); assertArrayEquals(tlsContext.getServerRandom(), new byte[] { 0, 1 }); assertTrue(action.isExecuted()); }