ChangeCompressionAction 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.getSelectedCompressionMethod(); tlsContext.setSelectedCompressionMethod(newValue); tlsContext.getRecordLayer().updateCompressor(); tlsContext.getRecordLayer().updateDecompressor(); LOGGER.info("Changed selected CompressionMethod from " + (oldValue == null ? "null" : oldValue.name()) + " to " + newValue.name()); setExecuted(true); } ChangeCompressionAction(CompressionMethod newValue);  ChangeCompressionAction(); void setNewValue(CompressionMethod newValue); CompressionMethod getNewValue(); CompressionMethod 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.setSelectedCompressionMethod(CompressionMethod.NULL); action.execute(state); assertEquals(action.getOldValue(), CompressionMethod.NULL); assertEquals(action.getNewValue(), CompressionMethod.LZS); assertEquals(tlsContext.getSelectedCompressionMethod(), CompressionMethod.LZS); assertTrue(action.isExecuted()); }