Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B5CA91877B for ; Fri, 22 Jan 2016 14:59:49 +0000 (UTC) Received: (qmail 6937 invoked by uid 500); 22 Jan 2016 14:59:49 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 6798 invoked by uid 500); 22 Jan 2016 14:59:49 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 6781 invoked by uid 99); 22 Jan 2016 14:59:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Jan 2016 14:59:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7BE2BE03CD; Fri, 22 Jan 2016 14:59:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gzurowski@apache.org To: commits@camel.apache.org Date: Fri, 22 Jan 2016 14:59:50 -0000 Message-Id: <43e9c1f5682b45e3963db8c666331cdb@git.apache.org> In-Reply-To: <6668c317148a407196a0ebf5270edcae@git.apache.org> References: <6668c317148a407196a0ebf5270edcae@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] camel git commit: Fix Checkstyle issues Fix Checkstyle issues Signed-off-by: Gregor Zurowski Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ccac114b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ccac114b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ccac114b Branch: refs/heads/master Commit: ccac114b8f30858ced2be908266ddc6cc3d34a6a Parents: 8be9327 Author: Gregor Zurowski Authored: Fri Jan 22 15:52:55 2016 +0100 Committer: Gregor Zurowski Committed: Fri Jan 22 15:59:35 2016 +0100 ---------------------------------------------------------------------- .../component/netty4/NettyProducerHangTest.java | 58 ++++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/ccac114b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java index 199180d..2a23d8e 100644 --- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java +++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java @@ -16,18 +16,18 @@ */ package org.apache.camel.component.netty4; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + public class NettyProducerHangTest extends CamelTestSupport { - private static int PORT = 4093; + private static int PORT = 4093; @Test public void nettyProducerHangsOnTheSecondRequestToTheSocketWhichIsClosed() throws Exception { @@ -40,7 +40,7 @@ public class NettyProducerHangTest extends CamelTestSupport { } catch (IOException e) { log.error("Exception occured: " + e.getMessage(), e); } - } + } }).start(); String response1 = template.requestBody("netty4:tcp://localhost:" + PORT + "?textline=true&sync=true", "request1", String.class); @@ -48,7 +48,7 @@ public class NettyProducerHangTest extends CamelTestSupport { try { // our test server will close the socket now so we should get an error - template.requestBody("netty4:tcp://localhost:" + PORT + "?textline=true&sync=true", "request2", String.class); + template.requestBody("netty4:tcp://localhost:" + PORT + "?textline=true&sync=true", "request2", String.class); } catch (Exception e) { assertStringContains(e.getCause().getMessage(), "No response received from remote server"); } @@ -58,36 +58,36 @@ public class NettyProducerHangTest extends CamelTestSupport { try { // our test server will close the socket now so we should get an error - template.requestBody("netty4:tcp://localhost:" + PORT + "?textline=true&sync=true", "request4", String.class); + template.requestBody("netty4:tcp://localhost:" + PORT + "?textline=true&sync=true", "request4", String.class); } catch (Exception e) { assertStringContains(e.getCause().getMessage(), "No response received from remote server"); } } - private void acceptReplyAcceptClose() throws IOException { - byte buf[] = new byte[128]; + private void acceptReplyAcceptClose() throws IOException { + byte buf[] = new byte[128]; + + ServerSocket serverSocket = new ServerSocket(PORT); + Socket soc = serverSocket.accept(); - ServerSocket serverSocket = new ServerSocket(PORT); - Socket soc = serverSocket.accept(); + log.info("Open socket and accept data"); + try (InputStream is = soc.getInputStream(); + OutputStream os = soc.getOutputStream()) { + // read first message + is.read(buf); - log.info("Open socket and accept data"); - try (InputStream is = soc.getInputStream(); - OutputStream os = soc.getOutputStream()) { - // read first message - is.read(buf); - - // reply to the first message - os.write("response\n".getBytes()); - - // read second message - is.read(buf); + // reply to the first message + os.write("response\n".getBytes()); + + // read second message + is.read(buf); - // do not reply, just close socket (emulate network problem) - } finally { - soc.close(); - serverSocket.close(); - } - log.info("Close socket"); - } + // do not reply, just close socket (emulate network problem) + } finally { + soc.close(); + serverSocket.close(); + } + log.info("Close socket"); + } }