private void open(final ModifyConnectionResponse response) { localDescriptor = response.getLocalConnectionDescriptor(); fireModified(); }
public String encode(JainMgcpResponseEvent event) { ModifyConnectionResponse response = (ModifyConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); StringBuffer s = new StringBuffer(); s.append(returnCode.getValue()).append(SINGLE_CHAR_SPACE).append(response.getTransactionHandle()).append( SINGLE_CHAR_SPACE).append(returnCode.getComment()).append(NEW_LINE); if (response.getLocalConnectionDescriptor() != null) { s.append(NEW_LINE).append(response.getLocalConnectionDescriptor()); } return s.toString(); }
private void halfOpen(final ModifyConnectionResponse response) { localDescriptor = response.getLocalConnectionDescriptor(); setState(OPEN); fireOpen(); }
public int encode(JainMgcpResponseEvent event,byte[] array) { ModifyConnectionResponse response = (ModifyConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getLocalConnectionDescriptor() != null) { array[totalLength++]=StringFunctions.NEWLINE_BYTE; byte[] rcdBytes=response.getLocalConnectionDescriptor().toString().getBytes(); System.arraycopy(rcdBytes, 0, array,totalLength, rcdBytes.length); totalLength+=rcdBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; } return totalLength; }
public int encode(JainMgcpResponseEvent event,byte[] array) { ModifyConnectionResponse response = (ModifyConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getLocalConnectionDescriptor() != null) { array[totalLength++]=StringFunctions.NEWLINE_BYTE; byte[] rcdBytes=response.getLocalConnectionDescriptor().toString().getBytes(); System.arraycopy(rcdBytes, 0, array,totalLength, rcdBytes.length); totalLength+=rcdBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; } return totalLength; }
@Override public void execute(final Object message) throws Exception { /* Stop the timer. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); // Handle results from opening or modifying states. final Class<?> klass = message.getClass(); if (CreateConnectionResponse.class.equals(klass)) { super.execute(message); } else if (ModifyConnectionResponse.class.equals(klass)) { final ModifyConnectionResponse response = (ModifyConnectionResponse) message; localDesc = response.getLocalConnectionDescriptor(); } final ConnectionStateChanged event = new ConnectionStateChanged(localDesc, ConnectionStateChanged.State.OPEN, connId); for (final ActorRef observer : observers) { observer.tell(event, source); } // Log the state change. log(ConnectionStateChanged.State.OPEN); } }
@Override public void execute(final Object message) throws Exception { /* Stop the timer. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); if (remoteDesc != null && remoteDesc.toString().contains("PleaseFailThisConnection")) { final CreateConnectionResponse response = (CreateConnectionResponse) message; if (connId == null) { connId = response.getConnectionIdentifier(); } fsm.transition(message, closing); return; } // Handle results from opening or modifying states. final Class<?> klass = message.getClass(); if (CreateConnectionResponse.class.equals(klass)) { super.execute(message); } else if (ModifyConnectionResponse.class.equals(klass)) { final ModifyConnectionResponse response = (ModifyConnectionResponse) message; localDesc = response.getLocalConnectionDescriptor(); } final ConnectionStateChanged event = new ConnectionStateChanged(localDesc, ConnectionStateChanged.State.OPEN, connId); for (final ActorRef observer : observers) { observer.tell(event, source); } // Log the state change. log(ConnectionStateChanged.State.OPEN); } }
public void processMgcpResponseEvent(JainMgcpResponseEvent evt) { ModifyConnectionResponse resp = (ModifyConnectionResponse) evt; switch (resp.getReturnCode().getValue()) { case ReturnCode.TRANSACTION_BEING_EXECUTED: return; case ReturnCode.TRANSACTION_EXECUTED_NORMALLY: try { connection.sdpPortManager.setLocalDescriptor(resp.getLocalConnectionDescriptor().toString()); connection.fsm.signal(ConnectionTransition.OPENED); } catch (UnknownTransitionException e) { } catch (Exception e) { e.printStackTrace(); connection.fsm.signalAsync(ConnectionTransition.FAILURE); } break; case ReturnCode.ENDPOINT_UNKNOWN : break; case ReturnCode.CONNECTION_WAS_DELETED: break; default: break; } } }
public void processMgcpResponseEvent(JainMgcpResponseEvent evt) { ModifyConnectionResponse resp = (ModifyConnectionResponse) evt; switch (resp.getReturnCode().getValue()) { case ReturnCode.TRANSACTION_BEING_EXECUTED: return; case ReturnCode.TRANSACTION_EXECUTED_NORMALLY: try { connection.sdpPortManager.setLocalDescriptor(resp.getLocalConnectionDescriptor().toString()); connection.fsm.signal(ConnectionTransition.OPENED); } catch (UnknownTransitionException e) { } catch (Exception e) { e.printStackTrace(); connection.fsm.signalAsync(ConnectionTransition.FAILURE); } break; case ReturnCode.ENDPOINT_UNKNOWN : break; case ReturnCode.CONNECTION_WAS_DELETED: break; default: break; } } }