@Test public void validateSuccessfullConnectionAndCommunicationWithClientBufferSmallerThenMessage() throws Exception { int port = this.availablePort(); String msgToSend = "Hello from validateSuccessfullConnectionAndCommunicationWithClientBufferSmallerThenMessage"; InetSocketAddress address = new InetSocketAddress(port); Server server = new Server(address, 1024, EOM); server.start(); ReceivingClient client = new ReceivingClient(address, this.scheduler, 64, EOM); List<String> messages = new ArrayList<>(); client.setMessageHandler((fromAddress, message, partialMessage) -> messages.add(new String(message, StandardCharsets.UTF_8))); client.start(); assertTrue(client.isRunning()); this.sendToSocket(address, msgToSend); this.sendToSocket(address, "\r"); Thread.sleep(200); assertEquals("Hello from validateSuccessfullConnectionAndCommunicationWithClie", messages.get(0)); assertEquals("ntBufferSmallerThenMessage\r", messages.get(1)); client.stop(); server.stop(); assertFalse(client.isRunning()); assertFalse(server.isRunning()); }
public void setMessageHandler(MessageHandler messageHandler) { this.messageHandler = messageHandler; }
ReceivingClient extends AbstractSocketHandler { public void setMessageHandler(MessageHandler messageHandler) { this.messageHandler = messageHandler; } }
ReceivingClient extends AbstractSocketHandler { public void setMessageHandler(MessageHandler messageHandler) { this.messageHandler = messageHandler; } ReceivingClient(InetSocketAddress address, ScheduledExecutorService connectionScheduler, int readingBufferSize, byte endOfMessageByte); }
ReceivingClient extends AbstractSocketHandler { public void setMessageHandler(MessageHandler messageHandler) { this.messageHandler = messageHandler; } ReceivingClient(InetSocketAddress address, ScheduledExecutorService connectionScheduler, int readingBufferSize, byte endOfMessageByte); void setReconnectAttempts(int reconnectAttempts); void setDelayMillisBeforeReconnect(long delayMillisBeforeReconnect); void setMessageHandler(MessageHandler messageHandler); }
ReceivingClient extends AbstractSocketHandler { public void setMessageHandler(MessageHandler messageHandler) { this.messageHandler = messageHandler; } ReceivingClient(InetSocketAddress address, ScheduledExecutorService connectionScheduler, int readingBufferSize, byte endOfMessageByte); void setReconnectAttempts(int reconnectAttempts); void setDelayMillisBeforeReconnect(long delayMillisBeforeReconnect); void setMessageHandler(MessageHandler messageHandler);  }