@Test public void testParseOkResponse() throws MgcpParseException { StringBuilder builder = new StringBuilder(); builder.append("200 147483653 Successful Transaction").append(System.lineSeparator()); builder.append("I:1f").append(System.lineSeparator()); builder.append("Z:mobicents/bridge/1@127.0.0.1:2427").append(System.lineSeparator()); builder.append("Z2:mobicents/ivr/1@127.0.0.1:2427").append(System.lineSeparator()); builder.append("I2:10").append(System.lineSeparator()); MgcpMessageParser parser = new MgcpMessageParser(); MgcpResponse response = parser.parseResponse(builder.toString()); assertEquals(200, response.getCode()); assertEquals(147483653, response.getTransactionId()); assertEquals("Successful Transaction", response.getMessage()); assertEquals("1f", response.getParameter(MgcpParameterType.CONNECTION_ID)); assertEquals("mobicents/bridge/1@127.0.0.1:2427", response.getParameter(MgcpParameterType.ENDPOINT_ID)); assertEquals("mobicents/ivr/1@127.0.0.1:2427", response.getParameter(MgcpParameterType.SECOND_ENDPOINT)); assertEquals("10", response.getParameter(MgcpParameterType.CONNECTION_ID2)); }
public MgcpResponse parseResponse(byte[] data, int offset, int length) throws MgcpParseException { return parseResponse(new String(data, offset, length)); }
MgcpMessageParser { public MgcpResponse parseResponse(byte[] data, int offset, int length) throws MgcpParseException { return parseResponse(new String(data, offset, length)); } }
MgcpMessageParser { public MgcpResponse parseResponse(byte[] data, int offset, int length) throws MgcpParseException { return parseResponse(new String(data, offset, length)); } MgcpMessageParser(); }
MgcpMessageParser { public MgcpResponse parseResponse(byte[] data, int offset, int length) throws MgcpParseException { return parseResponse(new String(data, offset, length)); } MgcpMessageParser(); MgcpRequest parseRequest(byte[] data, int offset, int length); MgcpRequest parseRequest(String message); MgcpResponse parseResponse(byte[] data, int offset, int length); MgcpResponse parseResponse(String message); }
MgcpMessageParser { public MgcpResponse parseResponse(byte[] data, int offset, int length) throws MgcpParseException { return parseResponse(new String(data, offset, length)); } MgcpMessageParser(); MgcpRequest parseRequest(byte[] data, int offset, int length); MgcpRequest parseRequest(String message); MgcpResponse parseResponse(byte[] data, int offset, int length); MgcpResponse parseResponse(String message);  }