Search in sources :

Example 1 with ByteArrayRawSerializer

use of org.springframework.integration.ip.tcp.serializer.ByteArrayRawSerializer in project spring-integration by spring-projects.

the class ConnectionToConnectionTests method testConnectRaw.

@Test
public void testConnectRaw() throws Exception {
    ByteArrayRawSerializer serializer = new ByteArrayRawSerializer();
    clientNet.setSerializer(serializer);
    serverNet.setDeserializer(serializer);
    clientNet.start();
    TcpConnection connection = clientNet.getConnection();
    connection.send(MessageBuilder.withPayload("Test").build());
    connection.close();
    Message<?> message = serverSideChannel.receive(10000);
    assertNotNull(message);
    MessageHistory history = MessageHistory.read(message);
    // org.springframework.integration.test.util.TestUtils
    Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "gwNet", 0);
    assertNotNull(componentHistoryRecord);
    assertTrue(componentHistoryRecord.get("type").equals("ip:tcp-inbound-gateway"));
    assertNotNull(message);
    assertEquals("Test", new String((byte[]) message.getPayload()));
}
Also used : MessageHistory(org.springframework.integration.history.MessageHistory) ByteArrayRawSerializer(org.springframework.integration.ip.tcp.serializer.ByteArrayRawSerializer) TcpConnection(org.springframework.integration.ip.tcp.connection.TcpConnection) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

Properties (java.util.Properties)1 Test (org.junit.Test)1 MessageHistory (org.springframework.integration.history.MessageHistory)1 TcpConnection (org.springframework.integration.ip.tcp.connection.TcpConnection)1 ByteArrayRawSerializer (org.springframework.integration.ip.tcp.serializer.ByteArrayRawSerializer)1