summaryrefslogtreecommitdiff
path: root/java/java/client/test/src/org/apache/qpid/mina/BlockingAcceptorTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/java/client/test/src/org/apache/qpid/mina/BlockingAcceptorTest.java')
-rw-r--r--java/java/client/test/src/org/apache/qpid/mina/BlockingAcceptorTest.java94
1 files changed, 0 insertions, 94 deletions
diff --git a/java/java/client/test/src/org/apache/qpid/mina/BlockingAcceptorTest.java b/java/java/client/test/src/org/apache/qpid/mina/BlockingAcceptorTest.java
deleted file mode 100644
index 79dba32e47..0000000000
--- a/java/java/client/test/src/org/apache/qpid/mina/BlockingAcceptorTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.mina;
-
-import junit.framework.JUnit4TestAdapter;
-import org.apache.log4j.Logger;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class BlockingAcceptorTest
-{
- private static final Logger _logger = Logger.getLogger(BlockingAcceptorTest.class);
-
- public static int PORT = 9999;
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(AcceptorTest.class);
- }
-
- @Test
- public void startAcceptor() throws IOException
- {
-
- ServerSocket sock = new ServerSocket(PORT);
-
- sock.setReuseAddress(true);
- sock.setReceiveBufferSize(32768);
- _logger.info("Bound on port " + PORT);
-
- while (true)
- {
- final Socket s = sock.accept();
- _logger.info("Received connection from " + s.getRemoteSocketAddress());
- s.setReceiveBufferSize(32768);
- s.setSendBufferSize(32768);
- s.setTcpNoDelay(true);
- new Thread(new Runnable()
- {
- public void run()
- {
- byte[] chunk = new byte[32768];
- try
- {
- InputStream is = s.getInputStream();
- OutputStream os = s.getOutputStream();
-
- while (true)
- {
- int count = is.read(chunk, 0, chunk.length);
- if (count > 0)
- {
- os.write(chunk, 0, count);
- }
- }
- }
- catch (IOException e)
- {
- _logger.error("Error - closing connection: " + e, e);
- }
- }
- }, "SocketReaderWriter").start();
- }
- }
-
- public static void main(String[] args) throws IOException
- {
- BlockingAcceptorTest a = new BlockingAcceptorTest();
- a.startAcceptor();
- }
-}