@Override public Void answer(InvocationOnMock invocation) throws Throwable { invocation.callRealMethod(); String log = invocation.getArgument(0); if (log.startsWith("Response")) { new SimpleAsyncTaskExecutor() .execute(() -> gate.handleMessage(new GenericMessage<>("bar"))); // hold up the first thread until the second has added its pending reply latch.await(10, TimeUnit.SECONDS); } else if (log.startsWith("Added")) { latch.countDown(); } return null; } }).when(logger).debug(anyString());
final int j = i; results[j] = (this.executor.submit(() -> { gateway.handleMessage(MessageBuilder.withPayload("Test" + j).build()); return j; }));
gateway.handleMessage(message); Message<?> reply = outputChannel.receive(0); assertNotNull(reply);
gateway.handleMessage(message); Message<?> reply = outputChannel.receive(0); assertNotNull(reply);
gateway.start(); try { gateway.handleMessage(MessageBuilder.withPayload("Test").build()); fail("expected failure");
gateway.setOutputChannel(replyChannel); for (int i = 100; i < 110; i++) { gateway.handleMessage(MessageBuilder.withPayload("Test" + i).build());
gateway.setRequestTimeout(60000); for (int i = 100; i < 200; i++) { gateway.handleMessage(MessageBuilder.withPayload("Test" + i).build());
final int j = i; results[j] = (this.executor.submit(() -> { gateway.handleMessage(MessageBuilder.withPayload("Test" + j).build()); return 0; }));
gateway.start(); try { gateway.handleMessage(MessageBuilder.withPayload("Test").build()); fail("expected failure");
gate.handleMessage(new GenericMessage<String>("foo")); Message<byte[]> result = (Message<byte[]>) outputChannel.receive(10000); assertNotNull(result);
Message<String> message = new GenericMessage<String>("foo"); outGateway.setRemoteTimeout(120000); outGateway.handleMessage(message); Socket socket = null; if (!singleUse) { TestingUtilities.waitStopListening(holder.server1, 10000L); TestingUtilities.waitUntilFactoryHasThisNumberOfConnections(client1, 0); outGateway.handleMessage(message); if (!singleUse) { socket = getSocket(client2);
Runnable command = () -> { try { out.handleMessage(MessageBuilder.withPayload("\u0004Test").build());
outbound.start(); outbound.handleMessage(new GenericMessage<String>("foo")); Message<byte[]> result = (Message<byte[]>) replyChannel.receive(10000); assertNotNull(result); outbound.handleMessage(new GenericMessage<String>("foo")); result = (Message<byte[]>) replyChannel.receive(10000); assertNotNull(result);