You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/12/29 02:10:43 UTC

svn commit: r729821 [1/5] - in /webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon: ./ eclipse/plugin/ eclipse/ui/ idea/plugin/ idea/ui/

Author: veithen
Date: Sun Dec 28 17:10:41 2008
New Revision: 729821

URL: http://svn.apache.org/viewvc?rev=729821&view=rev
Log:
Set svn:eol-style to native on Java files.

Modified:
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/AdminPane.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Connection.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Listener.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Relay.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Sender.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SlowLinkSimulator.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketRR.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/SocketWaiter.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TCPMon.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/TcpTunnel.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/plugin/TcpmonitorPlugin.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/ui/Connection.java   (props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/ui/Listener.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/ui/MainView.java   (props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/ui/Sender.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/ui/SocketRR.java   (props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/ui/SocketWaiter.java   (props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/eclipse/ui/TableEnhancer.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/idea/plugin/IdeaPlugin.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/idea/ui/ComponentHandler.java   (contents, props changed)
    webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/idea/ui/IdeaTCPMonToolWindow.java   (contents, props changed)

Modified: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/AdminPane.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/AdminPane.java?rev=729821&r1=729820&r2=729821&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/AdminPane.java (original)
+++ webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/AdminPane.java Sun Dec 28 17:10:41 2008
@@ -1,627 +1,627 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.ws.commons.tcpmon;
-
-import javax.swing.Box;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTextField;
-import javax.swing.border.TitledBorder;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.Document;
-import javax.swing.text.PlainDocument;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * this is the admin page
- */
-public class AdminPane extends JPanel {
-	
-    /**
-     * Field listenerButton, proxyButton
-     */
-    public JRadioButton listenerButton, proxyButton;
-
-    /**
-     * Field hostLabel, tportLabel
-     */
-    public JLabel hostLabel, tportLabel;
-
-    /**
-     * Field port
-     */
-    public NumberField port;
-
-    /**
-     * Field host
-     */
-    public HostnameField host;
-
-    /**
-     * Field tport
-     */
-    public NumberField tport;
-
-    /**
-     * Field noteb
-     */
-    public JTabbedPane noteb;
-
-    /**
-     * Field HTTPProxyBox
-     */
-    public JCheckBox HTTPProxyBox;
-
-    /**
-     * Field HTTPProxyHost
-     */
-    public HostnameField HTTPProxyHost;
-
-    /**
-     * Field HTTPProxyPort
-     */
-    public NumberField HTTPProxyPort;
-
-    /**
-     * Field HTTPProxyHostLabel, HTTPProxyPortLabel
-     */
-    public JLabel HTTPProxyHostLabel, HTTPProxyPortLabel;
-
-    /**
-     * Field delayTimeLabel, delayBytesLabel
-     */
-    public JLabel delayTimeLabel, delayBytesLabel;
-
-    /**
-     * Field delayTime, delayBytes
-     */
-    public NumberField delayTime, delayBytes;
-
-    /**
-     * Field delayBox
-     */
-    public JCheckBox delayBox;
-
-    /**
-     * Constructor AdminPage
-     *
-     * @param notebook
-     * @param name
-     */
-    public AdminPane(JTabbedPane notebook, String name) {
-        JPanel mainPane = null;
-        JButton addButton = null;
-        this.setLayout(new BorderLayout());
-        noteb = notebook;
-        GridBagLayout layout = new GridBagLayout();
-        GridBagConstraints c = new GridBagConstraints();
-        mainPane = new JPanel(layout);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        mainPane.add(new JLabel(TCPMon.getMessage("newTCP00",
-                "Create a new TCPMon...")
-                + " "), c);
-
-        // Add some blank space
-        mainPane.add(Box.createRigidArea(new Dimension(1, 5)), c);
-
-        // The listener info
-        // /////////////////////////////////////////////////////////////////
-        JPanel tmpPanel = new JPanel(new GridBagLayout());
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = 1;
-        tmpPanel.add(new JLabel(TCPMon.getMessage("listenPort00",
-                "Listen Port #")
-                + " "), c);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        tmpPanel.add(port = new NumberField(4), c);
-        mainPane.add(tmpPanel, c);
-        mainPane.add(Box.createRigidArea(new Dimension(1, 5)), c);
-
-        // Group for the radio buttons
-        ButtonGroup btns = new ButtonGroup();
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        mainPane.add(new JLabel(TCPMon.getMessage("actAs00", "Act as a...")), c);
-
-        // Target Host/Port section
-        // /////////////////////////////////////////////////////////////////
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        final String listener = TCPMon.getMessage("listener00", "Listener");
-        mainPane.add(listenerButton = new JRadioButton(listener), c);
-        btns.add(listenerButton);
-        listenerButton.setSelected(true);
-        listenerButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event) {
-                if (listener.equals(event.getActionCommand())) {
-                    boolean state = listenerButton.isSelected();
-                    tport.setEnabled(state);
-                    host.setEnabled(state);
-                    hostLabel.setForeground(state
-                            ? Color.black
-                            : Color.gray);
-                    tportLabel.setForeground(state
-                            ? Color.black
-                            : Color.gray);
-                }
-            }
-        });
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = 1;
-        mainPane.add(Box.createRigidArea(new Dimension(25, 0)));
-        mainPane.add(hostLabel =
-                new JLabel(TCPMon.getMessage("targetHostname00",
-                        "Target Hostname")
-                + " "), c);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        host = new HostnameField(30);
-        mainPane.add(host, c);
-        host.setText(TCPMon.DEFAULT_HOST);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = 1;
-        mainPane.add(Box.createRigidArea(new Dimension(25, 0)));
-        mainPane.add(tportLabel =
-                new JLabel(TCPMon.getMessage("targetPort00", "Target Port #")
-                + " "), c);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        tport = new NumberField(4);
-        mainPane.add(tport, c);
-        tport.setValue(TCPMon.DEFAULT_PORT);
-
-        // Act as proxy section
-        // /////////////////////////////////////////////////////////////////
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        final String proxy = TCPMon.getMessage("proxy00", "Proxy");
-        mainPane.add(proxyButton = new JRadioButton(proxy), c);
-        btns.add(proxyButton);
-        proxyButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event) {
-                if (proxy.equals(event.getActionCommand())) {
-                    boolean state = proxyButton.isSelected();
-                    tport.setEnabled(!state);
-                    host.setEnabled(!state);
-                    hostLabel.setForeground(state
-                            ? Color.gray
-                            : Color.black);
-                    tportLabel.setForeground(state
-                            ? Color.gray
-                            : Color.black);
-                }
-            }
-        });
-
-        // Spacer
-        // ///////////////////////////////////////////////////////////////
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        mainPane.add(Box.createRigidArea(new Dimension(1, 10)), c);
-
-        // Options section
-        // /////////////////////////////////////////////////////////////////
-        JPanel opts = new JPanel(new GridBagLayout());
-        opts.setBorder(new TitledBorder(TCPMon.getMessage("options00",
-                "Options")));
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        mainPane.add(opts, c);
-
-        // HTTP Proxy Support section
-        // /////////////////////////////////////////////////////////////////
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        final String proxySupport = TCPMon.getMessage("proxySupport00",
-                "HTTP Proxy Support");
-        opts.add(HTTPProxyBox = new JCheckBox(proxySupport), c);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = 1;
-        opts.add(HTTPProxyHostLabel =
-                new JLabel(TCPMon.getMessage("hostname00", "Hostname") + " "),
-                c);
-        HTTPProxyHostLabel.setForeground(Color.gray);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        opts.add(HTTPProxyHost = new HostnameField(30), c);
-        HTTPProxyHost.setEnabled(false);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = 1;
-        opts.add(HTTPProxyPortLabel =
-                new JLabel(TCPMon.getMessage("port00", "Port #") + " "), c);
-        HTTPProxyPortLabel.setForeground(Color.gray);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        opts.add(HTTPProxyPort = new NumberField(4), c);
-        HTTPProxyPort.setEnabled(false);
-        HTTPProxyBox.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event) {
-                if (proxySupport.equals(event.getActionCommand())) {
-                    boolean b = HTTPProxyBox.isSelected();
-                    Color color = b
-                            ? Color.black
-                            : Color.gray;
-                    HTTPProxyHost.setEnabled(b);
-                    HTTPProxyPort.setEnabled(b);
-                    HTTPProxyHostLabel.setForeground(color);
-                    HTTPProxyPortLabel.setForeground(color);
-                }
-            }
-        });
-
-        // Set default proxy values...
-        String tmp = System.getProperty("http.proxyHost");
-        if ((tmp != null) && tmp.equals("")) {
-            tmp = null;
-        }
-        HTTPProxyBox.setSelected(tmp != null);
-        HTTPProxyHost.setEnabled(tmp != null);
-        HTTPProxyPort.setEnabled(tmp != null);
-        HTTPProxyHostLabel.setForeground((tmp != null)
-                ? Color.black
-                : Color.gray);
-        HTTPProxyPortLabel.setForeground((tmp != null)
-                ? Color.black
-                : Color.gray);
-        if (tmp != null) {
-            HTTPProxyBox.setSelected(true);
-            HTTPProxyHost.setText(tmp);
-            tmp = System.getProperty("http.proxyPort");
-            if ((tmp != null) && tmp.equals("")) {
-                tmp = null;
-            }
-            if (tmp == null) {
-                tmp = "80";
-            }
-            HTTPProxyPort.setText(tmp);
-        }
-
-        // add byte delay fields
-        opts.add(Box.createRigidArea(new Dimension(1, 10)), c);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        final String delaySupport = TCPMon.getMessage("delay00",
-                "Simulate Slow Connection");
-        opts.add(delayBox = new JCheckBox(delaySupport), c);
-
-        // bytes per pause
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = 1;
-        delayBytesLabel = new JLabel(TCPMon.getMessage("delay01",
-                "Bytes per Pause"));
-        opts.add(delayBytesLabel, c);
-        delayBytesLabel.setForeground(Color.gray);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        opts.add(delayBytes = new NumberField(6), c);
-        delayBytes.setEnabled(false);
-
-        // delay interval
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = 1;
-        delayTimeLabel = new JLabel(TCPMon.getMessage("delay02",
-                "Delay in Milliseconds"));
-        opts.add(delayTimeLabel, c);
-        delayTimeLabel.setForeground(Color.gray);
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        opts.add(delayTime = new NumberField(6), c);
-        delayTime.setEnabled(false);
-
-        // enabler callback
-        delayBox.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event) {
-                if (delaySupport.equals(event.getActionCommand())) {
-                    boolean b = delayBox.isSelected();
-                    Color color = b
-                            ? Color.black
-                            : Color.gray;
-                    delayBytes.setEnabled(b);
-                    delayTime.setEnabled(b);
-                    delayBytesLabel.setForeground(color);
-                    delayTimeLabel.setForeground(color);
-                }
-            }
-        });
-
-        // Spacer
-        // ////////////////////////////////////////////////////////////////
-        mainPane.add(Box.createRigidArea(new Dimension(1, 10)), c);
-
-        // ADD Button
-        // /////////////////////////////////////////////////////////////////
-        c.anchor = GridBagConstraints.WEST;
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        final String add = TCPMon.getMessage("add00", "Add");
-        mainPane.add(addButton = new JButton(add), c);
-        this.add(new JScrollPane(mainPane), BorderLayout.CENTER);
-
-        // addButton.setEnabled( false );
-        addButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent event) {
-                if (add.equals(event.getActionCommand())) {
-                    String text;
-                    Listener l = null;
-                    int lPort;
-                    lPort = port.getValue(0);
-                    if (lPort == 0) {
-
-                        // no port, button does nothing
-                        return;
-                    }
-                    String tHost = host.getText();
-                    int tPort = 0;
-                    tPort = tport.getValue(0);
-                    SlowLinkSimulator slowLink = null;
-                    if (delayBox.isSelected()) {
-                        int bytes = delayBytes.getValue(0);
-                        int time = delayTime.getValue(0);
-                        slowLink = new SlowLinkSimulator(bytes, time);
-                    }
-                    try {
-                        l = new Listener(noteb, null, lPort, tHost, tPort,
-                                proxyButton.isSelected(),
-                                slowLink);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-
-                    // Pick-up the HTTP Proxy settings
-                    // /////////////////////////////////////////////////
-                    text = HTTPProxyHost.getText();
-                    if ("".equals(text)) {
-                        text = null;
-                    }
-                    l.HTTPProxyHost = text;
-                    text = HTTPProxyPort.getText();
-                    int proxyPort = HTTPProxyPort.getValue(-1);
-                    if (proxyPort != -1) {
-                        l.HTTPProxyPort = Integer.parseInt(text);
-                    }
-
-                    // reset the port
-                    port.setText(null);
-                }
-            }
-        });
-        notebook.addTab(name, this);
-        
-        new Sender(noteb);
-        notebook.repaint();
-        notebook.setSelectedIndex(notebook.getTabCount() - 1);
-    }
-    
-    /**
-     * a text field with a restricted set of characters
-     */
-    static class RestrictedTextField extends JTextField {
-        /**
-         * Field validText
-         */
-        protected String validText;
-
-        /**
-         * Constructor RestrictedTextField
-         *
-         * @param validText
-         */
-        public RestrictedTextField(String validText) {
-            setValidText(validText);
-        }
-
-        /**
-         * Constructor RestrictedTextField
-         *
-         * @param columns
-         * @param validText
-         */
-        public RestrictedTextField(int columns, String validText) {
-            super(columns);
-            setValidText(validText);
-        }
-
-        /**
-         * Constructor RestrictedTextField
-         *
-         * @param text
-         * @param validText
-         */
-        public RestrictedTextField(String text, String validText) {
-            super(text);
-            setValidText(validText);
-        }
-
-        /**
-         * Constructor RestrictedTextField
-         *
-         * @param text
-         * @param columns
-         * @param validText
-         */
-        public RestrictedTextField(String text, int columns, String validText) {
-            super(text, columns);
-            setValidText(validText);
-        }
-
-        /**
-         * Method setValidText
-         *
-         * @param validText
-         */
-        private void setValidText(String validText) {
-            this.validText = validText;
-        }
-
-        /**
-         * fascinatingly, this method is called in the super() constructor,
-         * meaning before we are fully initialized. C++ doesnt actually permit
-         * such a situation, but java clearly does...
-         *
-         * @return a new document
-         */
-        public Document createDefaultModel() {
-            return new RestrictedDocument();
-        }
-
-        /**
-         * this class strips out invaid chars
-         */
-        class RestrictedDocument extends PlainDocument {
-            /**
-             * Constructs a plain text document.  A default model using
-             * <code>GapContent</code> is constructed and set.
-             */
-            public RestrictedDocument() {
-            }
-
-            /**
-             * add a string; only those chars in the valid text list are allowed
-             *
-             * @param offset
-             * @param string
-             * @param attributes
-             * @throws BadLocationException
-             */
-            public void insertString(int offset,
-                                     String string,
-                                     AttributeSet attributes)
-                    throws BadLocationException {
-                if (string == null) {
-                    return;
-                }
-                int len = string.length();
-                StringBuffer buffer = new StringBuffer(string.length());
-                for (int i = 0; i < len; i++) {
-                    char ch = string.charAt(i);
-                    if (validText.indexOf(ch) >= 0) {
-                        buffer.append(ch);
-                    }
-                }
-                super.insertString(offset, new String(buffer), attributes);
-            }
-        }    // end class NumericDocument
-    }
-
-    /**
-     * because we cant use Java1.4's JFormattedTextField, here is
-     * a class that accepts numbers only
-     */
-    static class NumberField extends RestrictedTextField {
-        /**
-         * Field VALID_TEXT
-         */
-        private static final String VALID_TEXT = "0123456789";
-
-        /**
-         * Constructs a new <code>TextField</code>.  A default model is created,
-         * the initial string is <code>null</code>,
-         * and the number of columns is set to 0.
-         */
-        public NumberField() {
-            super(VALID_TEXT);
-        }
-
-        /**
-         * Constructs a new empty <code>TextField</code> with the specified
-         * number of columns.
-         * A default model is created and the initial string is set to
-         * <code>null</code>.
-         *
-         * @param columns the number of columns to use to calculate
-         *                the preferred width; if columns is set to zero, the
-         *                preferred width will be whatever naturally results from
-         *                the component implementation
-         */
-        public NumberField(int columns) {
-            super(columns, VALID_TEXT);
-        }
-
-        /**
-         * get the int value of a field, any invalid (non int) field returns
-         * the default
-         *
-         * @param def default value
-         * @return the field contents
-         */
-        public int getValue(int def) {
-            int result = def;
-            String text = getText();
-            if ((text != null) && (text.length() != 0)) {
-                try {
-                    result = Integer.parseInt(text);
-                } catch (NumberFormatException e) {
-                }
-            }
-            return result;
-        }
-
-        /**
-         * set the text to a numeric value
-         *
-         * @param value number to assign
-         */
-        public void setValue(int value) {
-            setText(Integer.toString(value));
-        }
-    }    // end class NumericTextField
-
-    /**
-     * hostname fields
-     */
-    static class HostnameField extends RestrictedTextField {
-
-        // list of valid chars in a hostname
-
-        /**
-         * Field VALID_TEXT
-         */
-        private static final String VALID_TEXT =
-                "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ-.";
-
-        /**
-         * Constructor HostnameField
-         *
-         * @param columns
-         */
-        public HostnameField(int columns) {
-            super(columns, VALID_TEXT);
-        }
-
-        /**
-         * Constructor HostnameField
-         */
-        public HostnameField() {
-            super(VALID_TEXT);
-        }
-    }    
-}
-
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.tcpmon;
+
+import javax.swing.Box;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+import javax.swing.border.TitledBorder;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.PlainDocument;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * this is the admin page
+ */
+public class AdminPane extends JPanel {
+	
+    /**
+     * Field listenerButton, proxyButton
+     */
+    public JRadioButton listenerButton, proxyButton;
+
+    /**
+     * Field hostLabel, tportLabel
+     */
+    public JLabel hostLabel, tportLabel;
+
+    /**
+     * Field port
+     */
+    public NumberField port;
+
+    /**
+     * Field host
+     */
+    public HostnameField host;
+
+    /**
+     * Field tport
+     */
+    public NumberField tport;
+
+    /**
+     * Field noteb
+     */
+    public JTabbedPane noteb;
+
+    /**
+     * Field HTTPProxyBox
+     */
+    public JCheckBox HTTPProxyBox;
+
+    /**
+     * Field HTTPProxyHost
+     */
+    public HostnameField HTTPProxyHost;
+
+    /**
+     * Field HTTPProxyPort
+     */
+    public NumberField HTTPProxyPort;
+
+    /**
+     * Field HTTPProxyHostLabel, HTTPProxyPortLabel
+     */
+    public JLabel HTTPProxyHostLabel, HTTPProxyPortLabel;
+
+    /**
+     * Field delayTimeLabel, delayBytesLabel
+     */
+    public JLabel delayTimeLabel, delayBytesLabel;
+
+    /**
+     * Field delayTime, delayBytes
+     */
+    public NumberField delayTime, delayBytes;
+
+    /**
+     * Field delayBox
+     */
+    public JCheckBox delayBox;
+
+    /**
+     * Constructor AdminPage
+     *
+     * @param notebook
+     * @param name
+     */
+    public AdminPane(JTabbedPane notebook, String name) {
+        JPanel mainPane = null;
+        JButton addButton = null;
+        this.setLayout(new BorderLayout());
+        noteb = notebook;
+        GridBagLayout layout = new GridBagLayout();
+        GridBagConstraints c = new GridBagConstraints();
+        mainPane = new JPanel(layout);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        mainPane.add(new JLabel(TCPMon.getMessage("newTCP00",
+                "Create a new TCPMon...")
+                + " "), c);
+
+        // Add some blank space
+        mainPane.add(Box.createRigidArea(new Dimension(1, 5)), c);
+
+        // The listener info
+        // /////////////////////////////////////////////////////////////////
+        JPanel tmpPanel = new JPanel(new GridBagLayout());
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = 1;
+        tmpPanel.add(new JLabel(TCPMon.getMessage("listenPort00",
+                "Listen Port #")
+                + " "), c);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        tmpPanel.add(port = new NumberField(4), c);
+        mainPane.add(tmpPanel, c);
+        mainPane.add(Box.createRigidArea(new Dimension(1, 5)), c);
+
+        // Group for the radio buttons
+        ButtonGroup btns = new ButtonGroup();
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        mainPane.add(new JLabel(TCPMon.getMessage("actAs00", "Act as a...")), c);
+
+        // Target Host/Port section
+        // /////////////////////////////////////////////////////////////////
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        final String listener = TCPMon.getMessage("listener00", "Listener");
+        mainPane.add(listenerButton = new JRadioButton(listener), c);
+        btns.add(listenerButton);
+        listenerButton.setSelected(true);
+        listenerButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                if (listener.equals(event.getActionCommand())) {
+                    boolean state = listenerButton.isSelected();
+                    tport.setEnabled(state);
+                    host.setEnabled(state);
+                    hostLabel.setForeground(state
+                            ? Color.black
+                            : Color.gray);
+                    tportLabel.setForeground(state
+                            ? Color.black
+                            : Color.gray);
+                }
+            }
+        });
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = 1;
+        mainPane.add(Box.createRigidArea(new Dimension(25, 0)));
+        mainPane.add(hostLabel =
+                new JLabel(TCPMon.getMessage("targetHostname00",
+                        "Target Hostname")
+                + " "), c);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        host = new HostnameField(30);
+        mainPane.add(host, c);
+        host.setText(TCPMon.DEFAULT_HOST);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = 1;
+        mainPane.add(Box.createRigidArea(new Dimension(25, 0)));
+        mainPane.add(tportLabel =
+                new JLabel(TCPMon.getMessage("targetPort00", "Target Port #")
+                + " "), c);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        tport = new NumberField(4);
+        mainPane.add(tport, c);
+        tport.setValue(TCPMon.DEFAULT_PORT);
+
+        // Act as proxy section
+        // /////////////////////////////////////////////////////////////////
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        final String proxy = TCPMon.getMessage("proxy00", "Proxy");
+        mainPane.add(proxyButton = new JRadioButton(proxy), c);
+        btns.add(proxyButton);
+        proxyButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                if (proxy.equals(event.getActionCommand())) {
+                    boolean state = proxyButton.isSelected();
+                    tport.setEnabled(!state);
+                    host.setEnabled(!state);
+                    hostLabel.setForeground(state
+                            ? Color.gray
+                            : Color.black);
+                    tportLabel.setForeground(state
+                            ? Color.gray
+                            : Color.black);
+                }
+            }
+        });
+
+        // Spacer
+        // ///////////////////////////////////////////////////////////////
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        mainPane.add(Box.createRigidArea(new Dimension(1, 10)), c);
+
+        // Options section
+        // /////////////////////////////////////////////////////////////////
+        JPanel opts = new JPanel(new GridBagLayout());
+        opts.setBorder(new TitledBorder(TCPMon.getMessage("options00",
+                "Options")));
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        mainPane.add(opts, c);
+
+        // HTTP Proxy Support section
+        // /////////////////////////////////////////////////////////////////
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        final String proxySupport = TCPMon.getMessage("proxySupport00",
+                "HTTP Proxy Support");
+        opts.add(HTTPProxyBox = new JCheckBox(proxySupport), c);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = 1;
+        opts.add(HTTPProxyHostLabel =
+                new JLabel(TCPMon.getMessage("hostname00", "Hostname") + " "),
+                c);
+        HTTPProxyHostLabel.setForeground(Color.gray);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        opts.add(HTTPProxyHost = new HostnameField(30), c);
+        HTTPProxyHost.setEnabled(false);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = 1;
+        opts.add(HTTPProxyPortLabel =
+                new JLabel(TCPMon.getMessage("port00", "Port #") + " "), c);
+        HTTPProxyPortLabel.setForeground(Color.gray);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        opts.add(HTTPProxyPort = new NumberField(4), c);
+        HTTPProxyPort.setEnabled(false);
+        HTTPProxyBox.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                if (proxySupport.equals(event.getActionCommand())) {
+                    boolean b = HTTPProxyBox.isSelected();
+                    Color color = b
+                            ? Color.black
+                            : Color.gray;
+                    HTTPProxyHost.setEnabled(b);
+                    HTTPProxyPort.setEnabled(b);
+                    HTTPProxyHostLabel.setForeground(color);
+                    HTTPProxyPortLabel.setForeground(color);
+                }
+            }
+        });
+
+        // Set default proxy values...
+        String tmp = System.getProperty("http.proxyHost");
+        if ((tmp != null) && tmp.equals("")) {
+            tmp = null;
+        }
+        HTTPProxyBox.setSelected(tmp != null);
+        HTTPProxyHost.setEnabled(tmp != null);
+        HTTPProxyPort.setEnabled(tmp != null);
+        HTTPProxyHostLabel.setForeground((tmp != null)
+                ? Color.black
+                : Color.gray);
+        HTTPProxyPortLabel.setForeground((tmp != null)
+                ? Color.black
+                : Color.gray);
+        if (tmp != null) {
+            HTTPProxyBox.setSelected(true);
+            HTTPProxyHost.setText(tmp);
+            tmp = System.getProperty("http.proxyPort");
+            if ((tmp != null) && tmp.equals("")) {
+                tmp = null;
+            }
+            if (tmp == null) {
+                tmp = "80";
+            }
+            HTTPProxyPort.setText(tmp);
+        }
+
+        // add byte delay fields
+        opts.add(Box.createRigidArea(new Dimension(1, 10)), c);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        final String delaySupport = TCPMon.getMessage("delay00",
+                "Simulate Slow Connection");
+        opts.add(delayBox = new JCheckBox(delaySupport), c);
+
+        // bytes per pause
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = 1;
+        delayBytesLabel = new JLabel(TCPMon.getMessage("delay01",
+                "Bytes per Pause"));
+        opts.add(delayBytesLabel, c);
+        delayBytesLabel.setForeground(Color.gray);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        opts.add(delayBytes = new NumberField(6), c);
+        delayBytes.setEnabled(false);
+
+        // delay interval
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = 1;
+        delayTimeLabel = new JLabel(TCPMon.getMessage("delay02",
+                "Delay in Milliseconds"));
+        opts.add(delayTimeLabel, c);
+        delayTimeLabel.setForeground(Color.gray);
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        opts.add(delayTime = new NumberField(6), c);
+        delayTime.setEnabled(false);
+
+        // enabler callback
+        delayBox.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                if (delaySupport.equals(event.getActionCommand())) {
+                    boolean b = delayBox.isSelected();
+                    Color color = b
+                            ? Color.black
+                            : Color.gray;
+                    delayBytes.setEnabled(b);
+                    delayTime.setEnabled(b);
+                    delayBytesLabel.setForeground(color);
+                    delayTimeLabel.setForeground(color);
+                }
+            }
+        });
+
+        // Spacer
+        // ////////////////////////////////////////////////////////////////
+        mainPane.add(Box.createRigidArea(new Dimension(1, 10)), c);
+
+        // ADD Button
+        // /////////////////////////////////////////////////////////////////
+        c.anchor = GridBagConstraints.WEST;
+        c.gridwidth = GridBagConstraints.REMAINDER;
+        final String add = TCPMon.getMessage("add00", "Add");
+        mainPane.add(addButton = new JButton(add), c);
+        this.add(new JScrollPane(mainPane), BorderLayout.CENTER);
+
+        // addButton.setEnabled( false );
+        addButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                if (add.equals(event.getActionCommand())) {
+                    String text;
+                    Listener l = null;
+                    int lPort;
+                    lPort = port.getValue(0);
+                    if (lPort == 0) {
+
+                        // no port, button does nothing
+                        return;
+                    }
+                    String tHost = host.getText();
+                    int tPort = 0;
+                    tPort = tport.getValue(0);
+                    SlowLinkSimulator slowLink = null;
+                    if (delayBox.isSelected()) {
+                        int bytes = delayBytes.getValue(0);
+                        int time = delayTime.getValue(0);
+                        slowLink = new SlowLinkSimulator(bytes, time);
+                    }
+                    try {
+                        l = new Listener(noteb, null, lPort, tHost, tPort,
+                                proxyButton.isSelected(),
+                                slowLink);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+
+                    // Pick-up the HTTP Proxy settings
+                    // /////////////////////////////////////////////////
+                    text = HTTPProxyHost.getText();
+                    if ("".equals(text)) {
+                        text = null;
+                    }
+                    l.HTTPProxyHost = text;
+                    text = HTTPProxyPort.getText();
+                    int proxyPort = HTTPProxyPort.getValue(-1);
+                    if (proxyPort != -1) {
+                        l.HTTPProxyPort = Integer.parseInt(text);
+                    }
+
+                    // reset the port
+                    port.setText(null);
+                }
+            }
+        });
+        notebook.addTab(name, this);
+        
+        new Sender(noteb);
+        notebook.repaint();
+        notebook.setSelectedIndex(notebook.getTabCount() - 1);
+    }
+    
+    /**
+     * a text field with a restricted set of characters
+     */
+    static class RestrictedTextField extends JTextField {
+        /**
+         * Field validText
+         */
+        protected String validText;
+
+        /**
+         * Constructor RestrictedTextField
+         *
+         * @param validText
+         */
+        public RestrictedTextField(String validText) {
+            setValidText(validText);
+        }
+
+        /**
+         * Constructor RestrictedTextField
+         *
+         * @param columns
+         * @param validText
+         */
+        public RestrictedTextField(int columns, String validText) {
+            super(columns);
+            setValidText(validText);
+        }
+
+        /**
+         * Constructor RestrictedTextField
+         *
+         * @param text
+         * @param validText
+         */
+        public RestrictedTextField(String text, String validText) {
+            super(text);
+            setValidText(validText);
+        }
+
+        /**
+         * Constructor RestrictedTextField
+         *
+         * @param text
+         * @param columns
+         * @param validText
+         */
+        public RestrictedTextField(String text, int columns, String validText) {
+            super(text, columns);
+            setValidText(validText);
+        }
+
+        /**
+         * Method setValidText
+         *
+         * @param validText
+         */
+        private void setValidText(String validText) {
+            this.validText = validText;
+        }
+
+        /**
+         * fascinatingly, this method is called in the super() constructor,
+         * meaning before we are fully initialized. C++ doesnt actually permit
+         * such a situation, but java clearly does...
+         *
+         * @return a new document
+         */
+        public Document createDefaultModel() {
+            return new RestrictedDocument();
+        }
+
+        /**
+         * this class strips out invaid chars
+         */
+        class RestrictedDocument extends PlainDocument {
+            /**
+             * Constructs a plain text document.  A default model using
+             * <code>GapContent</code> is constructed and set.
+             */
+            public RestrictedDocument() {
+            }
+
+            /**
+             * add a string; only those chars in the valid text list are allowed
+             *
+             * @param offset
+             * @param string
+             * @param attributes
+             * @throws BadLocationException
+             */
+            public void insertString(int offset,
+                                     String string,
+                                     AttributeSet attributes)
+                    throws BadLocationException {
+                if (string == null) {
+                    return;
+                }
+                int len = string.length();
+                StringBuffer buffer = new StringBuffer(string.length());
+                for (int i = 0; i < len; i++) {
+                    char ch = string.charAt(i);
+                    if (validText.indexOf(ch) >= 0) {
+                        buffer.append(ch);
+                    }
+                }
+                super.insertString(offset, new String(buffer), attributes);
+            }
+        }    // end class NumericDocument
+    }
+
+    /**
+     * because we cant use Java1.4's JFormattedTextField, here is
+     * a class that accepts numbers only
+     */
+    static class NumberField extends RestrictedTextField {
+        /**
+         * Field VALID_TEXT
+         */
+        private static final String VALID_TEXT = "0123456789";
+
+        /**
+         * Constructs a new <code>TextField</code>.  A default model is created,
+         * the initial string is <code>null</code>,
+         * and the number of columns is set to 0.
+         */
+        public NumberField() {
+            super(VALID_TEXT);
+        }
+
+        /**
+         * Constructs a new empty <code>TextField</code> with the specified
+         * number of columns.
+         * A default model is created and the initial string is set to
+         * <code>null</code>.
+         *
+         * @param columns the number of columns to use to calculate
+         *                the preferred width; if columns is set to zero, the
+         *                preferred width will be whatever naturally results from
+         *                the component implementation
+         */
+        public NumberField(int columns) {
+            super(columns, VALID_TEXT);
+        }
+
+        /**
+         * get the int value of a field, any invalid (non int) field returns
+         * the default
+         *
+         * @param def default value
+         * @return the field contents
+         */
+        public int getValue(int def) {
+            int result = def;
+            String text = getText();
+            if ((text != null) && (text.length() != 0)) {
+                try {
+                    result = Integer.parseInt(text);
+                } catch (NumberFormatException e) {
+                }
+            }
+            return result;
+        }
+
+        /**
+         * set the text to a numeric value
+         *
+         * @param value number to assign
+         */
+        public void setValue(int value) {
+            setText(Integer.toString(value));
+        }
+    }    // end class NumericTextField
+
+    /**
+     * hostname fields
+     */
+    static class HostnameField extends RestrictedTextField {
+
+        // list of valid chars in a hostname
+
+        /**
+         * Field VALID_TEXT
+         */
+        private static final String VALID_TEXT =
+                "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ-.";
+
+        /**
+         * Constructor HostnameField
+         *
+         * @param columns
+         */
+        public HostnameField(int columns) {
+            super(columns, VALID_TEXT);
+        }
+
+        /**
+         * Constructor HostnameField
+         */
+        public HostnameField() {
+            super(VALID_TEXT);
+        }
+    }    
+}
+

Propchange: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/AdminPane.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Connection.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Connection.java?rev=729821&r1=729820&r2=729821&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Connection.java (original)
+++ webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Connection.java Sun Dec 28 17:10:41 2008
@@ -1,504 +1,504 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.ws.commons.tcpmon;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.ListSelectionModel;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.Socket;
-import java.net.URL;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * a connection listens to a single current connection
- */
-class Connection extends Thread {
-
-	/**
-     * Field listener
-     */
-    Listener listener;
-
-    /**
-     * Field active
-     */
-    boolean active;
-
-    /**
-     * Field fromHost
-     */
-    String fromHost;
-
-    /**
-     * Field time
-     */
-    String time;
-
-    /**
-     * Field elapsed time
-     */
-    long elapsedTime;
-    
-    /**
-     * Field inputText
-     */
-    JTextArea inputText = null;
-
-    /**
-     * Field inputScroll
-     */
-    JScrollPane inputScroll = null;
-
-    /**
-     * Field outputText
-     */
-    JTextArea outputText = null;
-
-    /**
-     * Field outputScroll
-     */
-    JScrollPane outputScroll = null;
-
-    /**
-     * Field inSocket
-     */
-    Socket inSocket = null;
-
-    /**
-     * Field outSocket
-     */
-    Socket outSocket = null;
-
-    /**
-     * Field clientThread
-     */
-    Thread clientThread = null;
-
-    /**
-     * Field serverThread
-     */
-    Thread serverThread = null;
-
-    /**
-     * Field rr1
-     */
-    SocketRR rr1 = null;
-
-    /**
-     * Field rr2
-     */
-    SocketRR rr2 = null;
-
-    /**
-     * Field inputStream
-     */
-    InputStream inputStream = null;
-
-    /**
-     * Field HTTPProxyHost
-     */
-    String HTTPProxyHost = null;
-
-    /**
-     * Field HTTPProxyPort
-     */
-    int HTTPProxyPort = 80;
-
-    /**
-     * Field slowLink
-     */
-    private SlowLinkSimulator slowLink;
-
-    /**
-     * Constructor Connection
-     *
-     * @param l
-     */
-    public Connection(Listener l) {
-        listener = l;
-        HTTPProxyHost = l.HTTPProxyHost;
-        HTTPProxyPort = l.HTTPProxyPort;
-        slowLink = l.slowLink;
-    }
-
-    /**
-     * Constructor Connection
-     *
-     * @param l
-     * @param s
-     */
-    public Connection(Listener l, Socket s) {
-        this(l);
-        inSocket = s;
-        start();
-    }
-
-    /**
-     * Constructor Connection
-     *
-     * @param l
-     * @param in
-     */
-    public Connection(Listener l, InputStream in) {
-        this(l);
-        inputStream = in;
-        start();
-    }
-
-    /**
-     * Method run
-     */
-    public void run() {
-        try {
-            active = true;
-            HTTPProxyHost = System.getProperty("http.proxyHost");
-            if ((HTTPProxyHost != null) && HTTPProxyHost.equals("")) {
-                HTTPProxyHost = null;
-            }
-            if (HTTPProxyHost != null) {
-                String tmp = System.getProperty("http.proxyPort");
-                if ((tmp != null) && tmp.equals("")) {
-                    tmp = null;
-                }
-                if (tmp == null) {
-                    HTTPProxyPort = 80;
-                } else {
-                    HTTPProxyPort = Integer.parseInt(tmp);
-                }
-            }
-            if (inSocket != null) {
-                fromHost = (inSocket.getInetAddress()).getHostName();
-            } else {
-                fromHost = "resend";
-            }
-            String dateformat = TCPMon.getMessage("dateformat00", "yyyy-MM-dd HH:mm:ss");
-            DateFormat df = new SimpleDateFormat(dateformat);
-            time = df.format(new Date());
-            int count = listener.connections.size();
-            listener.tableModel.insertRow(count + 1,
-                    new Object[]{
-                        TCPMon.getMessage("active00","Active"),
-                        time,
-                        fromHost,
-                        listener.hostField.getText(),
-                        ""});
-            listener.connections.add(this);
-            inputText = new JTextArea(null, null, 20, 80);
-            inputScroll = new JScrollPane(inputText);
-            outputText = new JTextArea(null, null, 20, 80);
-            outputScroll = new JScrollPane(outputText);
-            ListSelectionModel lsm = listener.connectionTable.getSelectionModel();
-            if ((count == 0) || (lsm.getLeadSelectionIndex() == 0)) {
-                listener.outPane.setVisible(false);
-                int divLoc = listener.outPane.getDividerLocation();
-                listener.setLeft(inputScroll);
-                listener.setRight(outputScroll);
-                listener.removeButton.setEnabled(false);
-                listener.removeAllButton.setEnabled(true);
-                listener.saveButton.setEnabled(true);
-                listener.resendButton.setEnabled(true);
-                listener.outPane.setDividerLocation(divLoc);
-                listener.outPane.setVisible(true);
-            }
-            String targetHost = listener.hostField.getText();
-            int targetPort = Integer.parseInt(listener.tPortField.getText());
-            int listenPort = Integer.parseInt(listener.portField.getText());
-            InputStream tmpIn1 = inputStream;
-            OutputStream tmpOut1 = null;
-            InputStream tmpIn2 = null;
-            OutputStream tmpOut2 = null;
-            if (tmpIn1 == null) {
-                tmpIn1 = inSocket.getInputStream();
-            }
-            if (inSocket != null) {
-                tmpOut1 = inSocket.getOutputStream();
-            }
-            String bufferedData = null;
-            StringBuffer buf = null;
-            int index = listener.connections.indexOf(this);
-            if (listener.isProxyBox.isSelected() || (HTTPProxyHost != null)) {
-
-                // Check if we're a proxy
-                byte[] b = new byte[1];
-                buf = new StringBuffer();
-                String s;
-                for (; ;) {
-                    int len;
-                    len = tmpIn1.read(b, 0, 1);
-                    if (len == -1) {
-                        break;
-                    }
-                    s = new String(b);
-                    buf.append(s);
-                    if (b[0] != '\n') {
-                        continue;
-                    }
-                    break;
-                }
-                bufferedData = buf.toString();
-                inputText.append(bufferedData);
-                if (bufferedData.startsWith("GET ")
-                        || bufferedData.startsWith("POST ")
-                        || bufferedData.startsWith("PUT ")
-                        || bufferedData.startsWith("DELETE ")) {
-                    int start, end;
-                    URL url;
-                    start = bufferedData.indexOf(' ') + 1;
-                    while (bufferedData.charAt(start) == ' ') {
-                        start++;
-                    }
-                    end = bufferedData.indexOf(' ', start);
-                    String urlString = bufferedData.substring(start, end);
-                    if (urlString.charAt(0) == '/') {
-                        urlString = urlString.substring(1);
-                    }
-                    if (listener.isProxyBox.isSelected()) {
-                        url = new URL(urlString);
-                        targetHost = url.getHost();
-                        targetPort = url.getPort();
-                        if (targetPort == -1) {
-                            targetPort = 80;
-                        }
-                        listener.tableModel.setValueAt(targetHost,
-                                index + 1,
-                                TCPMon.OUTHOST_COLUMN);
-                        bufferedData = bufferedData.substring(0, start)
-                                + url.getFile()
-                                + bufferedData.substring(end);
-                    } else {
-                        url = new URL("http://" + targetHost + ":"
-                                + targetPort + "/" + urlString);
-                        listener.tableModel.setValueAt(targetHost,
-                                index + 1,
-                                TCPMon.OUTHOST_COLUMN);
-                        bufferedData = bufferedData.substring(0, start)
-                                + url.toExternalForm()
-                                + bufferedData.substring(end);
-                        targetHost = HTTPProxyHost;
-                        targetPort = HTTPProxyPort;
-                    }
-                }
-            } else {
-
-                // 
-                // Change Host: header to point to correct host
-                // 
-                byte[] b1 = new byte[1];
-                buf = new StringBuffer();
-                String s1;
-                String lastLine = null;
-                for (; ;) {
-                    int len;
-                    len = tmpIn1.read(b1, 0, 1);
-                    if (len == -1) {
-                        break;
-                    }
-                    s1 = new String(b1);
-                    buf.append(s1);
-                    if (b1[0] != '\n') {
-                        continue;
-                    }
-
-                    // we have a complete line
-                    String line = buf.toString();
-                    buf.setLength(0);
-
-                    // check to see if we have found Host: header
-                    if (line.startsWith("Host: ")) {
-
-                        // we need to update the hostname to target host
-                        String newHost = "Host: " + targetHost + ":"
-                                + listenPort + "\r\n";
-                        bufferedData = bufferedData.concat(newHost);
-                        break;
-                    }
-
-                    // add it to our headers so far
-                    if (bufferedData == null) {
-                        bufferedData = line;
-                    } else {
-                        bufferedData = bufferedData.concat(line);
-                    }
-
-                    // failsafe
-                    if (line.equals("\r\n")) {
-                        break;
-                    }
-                    if ("\n".equals(lastLine) && line.equals("\n")) {
-                        break;
-                    }
-                    lastLine = line;
-                }
-                if (bufferedData != null) {
-                    inputText.append(bufferedData);
-                    int idx = (bufferedData.length() < 50)
-                            ? bufferedData.length()
-                            : 50;
-                    s1 = bufferedData.substring(0, idx);
-                    int i = s1.indexOf('\n');
-                    if (i > 0) {
-                        s1 = s1.substring(0, i - 1);
-                    }
-                    s1 = s1 + "                           "
-                            + "                       ";
-                    s1 = s1.substring(0, 51);
-                    listener.tableModel.setValueAt(s1, index + 1,
-                    		TCPMon.REQ_COLUMN);
-                }
-            }
-            if (targetPort == -1) {
-                targetPort = 80;
-            }
-            outSocket = new Socket(targetHost, targetPort);
-            tmpIn2 = outSocket.getInputStream();
-            tmpOut2 = outSocket.getOutputStream();
-            if (bufferedData != null) {
-                byte[] b = bufferedData.getBytes();
-                tmpOut2.write(b);
-                slowLink.pump(b.length);
-            }
-            boolean format = listener.xmlFormatBox.isSelected();
-
-            // this is the channel to the endpoint
-            rr1 = new SocketRR(this, inSocket, tmpIn1, outSocket, tmpOut2,
-                    inputText, format, listener.tableModel,
-                    index + 1, "request:", slowLink);
-
-            // create the response slow link from the inbound slow link
-            SlowLinkSimulator responseLink =
-                    new SlowLinkSimulator(slowLink);
-
-            // this is the channel from the endpoint
-            rr2 = new SocketRR(this, outSocket, tmpIn2, inSocket, tmpOut1,
-                    outputText, format, null, 0, "response:",
-                    responseLink);
-            
-            while ((rr1 != null) || (rr2 != null)) {
-
-            		if (rr2 != null) {
-            			listener.tableModel.setValueAt(rr2.getElapsed(), 1 + index, TCPMon.ELAPSED_COLUMN);
-            		}
-            		
-                // Only loop as long as the connection to the target
-                // machine is available - once that's gone we can stop.
-                // The old way, loop until both are closed, left us
-                // looping forever since no one closed the 1st one.
-            	
-                if ((null != rr1) && rr1.isDone()) {
-                    if ((index >= 0) && (rr2 != null)) {
-                        listener.tableModel.setValueAt(
-                                TCPMon.getMessage("resp00", "Resp"), 1 + index,
-                                TCPMon.STATE_COLUMN);
-                    }
-                    rr1 = null;
-                }
-
-                if ((null != rr2) && rr2.isDone()) {
-                    if ((index >= 0) && (rr1 != null)) {
-                        listener.tableModel.setValueAt(
-                                TCPMon.getMessage("req00", "Req"), 1 + index,
-                                TCPMon.STATE_COLUMN);
-                    }
-                    rr2 = null;
-                }
-
-                synchronized (this) {
-                    this.wait(100);    // Safety just incase we're not told to wake up.
-                }
-            }
-
-            active = false;
-
-            if (index >= 0) {
-                listener.tableModel.setValueAt(
-                        TCPMon.getMessage("done00", "Done"),
-                        1 + index, TCPMon.STATE_COLUMN);
-            }
-
-        } catch (Exception e) {
-            StringWriter st = new StringWriter();
-            PrintWriter wr = new PrintWriter(st);
-            int index = listener.connections.indexOf(this);
-            if (index >= 0) {
-                listener.tableModel.setValueAt(
-                        TCPMon.getMessage("error00", "Error"), 1 + index,
-                        TCPMon.STATE_COLUMN);
-            }
-            e.printStackTrace(wr);
-            wr.close();
-            if (outputText != null) {
-                outputText.append(st.toString());
-            } else {
-                // something went wrong before we had the output area
-                System.out.println(st.toString());
-            }
-            halt();
-        }
-    }
-
-    /**
-     * Method wakeUp
-     */
-    synchronized void wakeUp() {
-        this.notifyAll();
-    }
-
-    /**
-     * Method halt
-     */
-    public void halt() {
-        try {
-            if (rr1 != null) {
-                rr1.halt();
-            }
-            if (rr2 != null) {
-                rr2.halt();
-            }
-            if (inSocket != null) {
-                inSocket.close();
-            }
-            inSocket = null;
-            if (outSocket != null) {
-                outSocket.close();
-            }
-            outSocket = null;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Method remove
-     */
-    public void remove() {
-        int index = -1;
-        try {
-            halt();
-            index = listener.connections.indexOf(this);
-            listener.tableModel.removeRow(index + 1);
-            listener.connections.remove(index);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.tcpmon;
+
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.ListSelectionModel;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.Socket;
+import java.net.URL;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * a connection listens to a single current connection
+ */
+class Connection extends Thread {
+
+	/**
+     * Field listener
+     */
+    Listener listener;
+
+    /**
+     * Field active
+     */
+    boolean active;
+
+    /**
+     * Field fromHost
+     */
+    String fromHost;
+
+    /**
+     * Field time
+     */
+    String time;
+
+    /**
+     * Field elapsed time
+     */
+    long elapsedTime;
+    
+    /**
+     * Field inputText
+     */
+    JTextArea inputText = null;
+
+    /**
+     * Field inputScroll
+     */
+    JScrollPane inputScroll = null;
+
+    /**
+     * Field outputText
+     */
+    JTextArea outputText = null;
+
+    /**
+     * Field outputScroll
+     */
+    JScrollPane outputScroll = null;
+
+    /**
+     * Field inSocket
+     */
+    Socket inSocket = null;
+
+    /**
+     * Field outSocket
+     */
+    Socket outSocket = null;
+
+    /**
+     * Field clientThread
+     */
+    Thread clientThread = null;
+
+    /**
+     * Field serverThread
+     */
+    Thread serverThread = null;
+
+    /**
+     * Field rr1
+     */
+    SocketRR rr1 = null;
+
+    /**
+     * Field rr2
+     */
+    SocketRR rr2 = null;
+
+    /**
+     * Field inputStream
+     */
+    InputStream inputStream = null;
+
+    /**
+     * Field HTTPProxyHost
+     */
+    String HTTPProxyHost = null;
+
+    /**
+     * Field HTTPProxyPort
+     */
+    int HTTPProxyPort = 80;
+
+    /**
+     * Field slowLink
+     */
+    private SlowLinkSimulator slowLink;
+
+    /**
+     * Constructor Connection
+     *
+     * @param l
+     */
+    public Connection(Listener l) {
+        listener = l;
+        HTTPProxyHost = l.HTTPProxyHost;
+        HTTPProxyPort = l.HTTPProxyPort;
+        slowLink = l.slowLink;
+    }
+
+    /**
+     * Constructor Connection
+     *
+     * @param l
+     * @param s
+     */
+    public Connection(Listener l, Socket s) {
+        this(l);
+        inSocket = s;
+        start();
+    }
+
+    /**
+     * Constructor Connection
+     *
+     * @param l
+     * @param in
+     */
+    public Connection(Listener l, InputStream in) {
+        this(l);
+        inputStream = in;
+        start();
+    }
+
+    /**
+     * Method run
+     */
+    public void run() {
+        try {
+            active = true;
+            HTTPProxyHost = System.getProperty("http.proxyHost");
+            if ((HTTPProxyHost != null) && HTTPProxyHost.equals("")) {
+                HTTPProxyHost = null;
+            }
+            if (HTTPProxyHost != null) {
+                String tmp = System.getProperty("http.proxyPort");
+                if ((tmp != null) && tmp.equals("")) {
+                    tmp = null;
+                }
+                if (tmp == null) {
+                    HTTPProxyPort = 80;
+                } else {
+                    HTTPProxyPort = Integer.parseInt(tmp);
+                }
+            }
+            if (inSocket != null) {
+                fromHost = (inSocket.getInetAddress()).getHostName();
+            } else {
+                fromHost = "resend";
+            }
+            String dateformat = TCPMon.getMessage("dateformat00", "yyyy-MM-dd HH:mm:ss");
+            DateFormat df = new SimpleDateFormat(dateformat);
+            time = df.format(new Date());
+            int count = listener.connections.size();
+            listener.tableModel.insertRow(count + 1,
+                    new Object[]{
+                        TCPMon.getMessage("active00","Active"),
+                        time,
+                        fromHost,
+                        listener.hostField.getText(),
+                        ""});
+            listener.connections.add(this);
+            inputText = new JTextArea(null, null, 20, 80);
+            inputScroll = new JScrollPane(inputText);
+            outputText = new JTextArea(null, null, 20, 80);
+            outputScroll = new JScrollPane(outputText);
+            ListSelectionModel lsm = listener.connectionTable.getSelectionModel();
+            if ((count == 0) || (lsm.getLeadSelectionIndex() == 0)) {
+                listener.outPane.setVisible(false);
+                int divLoc = listener.outPane.getDividerLocation();
+                listener.setLeft(inputScroll);
+                listener.setRight(outputScroll);
+                listener.removeButton.setEnabled(false);
+                listener.removeAllButton.setEnabled(true);
+                listener.saveButton.setEnabled(true);
+                listener.resendButton.setEnabled(true);
+                listener.outPane.setDividerLocation(divLoc);
+                listener.outPane.setVisible(true);
+            }
+            String targetHost = listener.hostField.getText();
+            int targetPort = Integer.parseInt(listener.tPortField.getText());
+            int listenPort = Integer.parseInt(listener.portField.getText());
+            InputStream tmpIn1 = inputStream;
+            OutputStream tmpOut1 = null;
+            InputStream tmpIn2 = null;
+            OutputStream tmpOut2 = null;
+            if (tmpIn1 == null) {
+                tmpIn1 = inSocket.getInputStream();
+            }
+            if (inSocket != null) {
+                tmpOut1 = inSocket.getOutputStream();
+            }
+            String bufferedData = null;
+            StringBuffer buf = null;
+            int index = listener.connections.indexOf(this);
+            if (listener.isProxyBox.isSelected() || (HTTPProxyHost != null)) {
+
+                // Check if we're a proxy
+                byte[] b = new byte[1];
+                buf = new StringBuffer();
+                String s;
+                for (; ;) {
+                    int len;
+                    len = tmpIn1.read(b, 0, 1);
+                    if (len == -1) {
+                        break;
+                    }
+                    s = new String(b);
+                    buf.append(s);
+                    if (b[0] != '\n') {
+                        continue;
+                    }
+                    break;
+                }
+                bufferedData = buf.toString();
+                inputText.append(bufferedData);
+                if (bufferedData.startsWith("GET ")
+                        || bufferedData.startsWith("POST ")
+                        || bufferedData.startsWith("PUT ")
+                        || bufferedData.startsWith("DELETE ")) {
+                    int start, end;
+                    URL url;
+                    start = bufferedData.indexOf(' ') + 1;
+                    while (bufferedData.charAt(start) == ' ') {
+                        start++;
+                    }
+                    end = bufferedData.indexOf(' ', start);
+                    String urlString = bufferedData.substring(start, end);
+                    if (urlString.charAt(0) == '/') {
+                        urlString = urlString.substring(1);
+                    }
+                    if (listener.isProxyBox.isSelected()) {
+                        url = new URL(urlString);
+                        targetHost = url.getHost();
+                        targetPort = url.getPort();
+                        if (targetPort == -1) {
+                            targetPort = 80;
+                        }
+                        listener.tableModel.setValueAt(targetHost,
+                                index + 1,
+                                TCPMon.OUTHOST_COLUMN);
+                        bufferedData = bufferedData.substring(0, start)
+                                + url.getFile()
+                                + bufferedData.substring(end);
+                    } else {
+                        url = new URL("http://" + targetHost + ":"
+                                + targetPort + "/" + urlString);
+                        listener.tableModel.setValueAt(targetHost,
+                                index + 1,
+                                TCPMon.OUTHOST_COLUMN);
+                        bufferedData = bufferedData.substring(0, start)
+                                + url.toExternalForm()
+                                + bufferedData.substring(end);
+                        targetHost = HTTPProxyHost;
+                        targetPort = HTTPProxyPort;
+                    }
+                }
+            } else {
+
+                // 
+                // Change Host: header to point to correct host
+                // 
+                byte[] b1 = new byte[1];
+                buf = new StringBuffer();
+                String s1;
+                String lastLine = null;
+                for (; ;) {
+                    int len;
+                    len = tmpIn1.read(b1, 0, 1);
+                    if (len == -1) {
+                        break;
+                    }
+                    s1 = new String(b1);
+                    buf.append(s1);
+                    if (b1[0] != '\n') {
+                        continue;
+                    }
+
+                    // we have a complete line
+                    String line = buf.toString();
+                    buf.setLength(0);
+
+                    // check to see if we have found Host: header
+                    if (line.startsWith("Host: ")) {
+
+                        // we need to update the hostname to target host
+                        String newHost = "Host: " + targetHost + ":"
+                                + listenPort + "\r\n";
+                        bufferedData = bufferedData.concat(newHost);
+                        break;
+                    }
+
+                    // add it to our headers so far
+                    if (bufferedData == null) {
+                        bufferedData = line;
+                    } else {
+                        bufferedData = bufferedData.concat(line);
+                    }
+
+                    // failsafe
+                    if (line.equals("\r\n")) {
+                        break;
+                    }
+                    if ("\n".equals(lastLine) && line.equals("\n")) {
+                        break;
+                    }
+                    lastLine = line;
+                }
+                if (bufferedData != null) {
+                    inputText.append(bufferedData);
+                    int idx = (bufferedData.length() < 50)
+                            ? bufferedData.length()
+                            : 50;
+                    s1 = bufferedData.substring(0, idx);
+                    int i = s1.indexOf('\n');
+                    if (i > 0) {
+                        s1 = s1.substring(0, i - 1);
+                    }
+                    s1 = s1 + "                           "
+                            + "                       ";
+                    s1 = s1.substring(0, 51);
+                    listener.tableModel.setValueAt(s1, index + 1,
+                    		TCPMon.REQ_COLUMN);
+                }
+            }
+            if (targetPort == -1) {
+                targetPort = 80;
+            }
+            outSocket = new Socket(targetHost, targetPort);
+            tmpIn2 = outSocket.getInputStream();
+            tmpOut2 = outSocket.getOutputStream();
+            if (bufferedData != null) {
+                byte[] b = bufferedData.getBytes();
+                tmpOut2.write(b);
+                slowLink.pump(b.length);
+            }
+            boolean format = listener.xmlFormatBox.isSelected();
+
+            // this is the channel to the endpoint
+            rr1 = new SocketRR(this, inSocket, tmpIn1, outSocket, tmpOut2,
+                    inputText, format, listener.tableModel,
+                    index + 1, "request:", slowLink);
+
+            // create the response slow link from the inbound slow link
+            SlowLinkSimulator responseLink =
+                    new SlowLinkSimulator(slowLink);
+
+            // this is the channel from the endpoint
+            rr2 = new SocketRR(this, outSocket, tmpIn2, inSocket, tmpOut1,
+                    outputText, format, null, 0, "response:",
+                    responseLink);
+            
+            while ((rr1 != null) || (rr2 != null)) {
+
+            		if (rr2 != null) {
+            			listener.tableModel.setValueAt(rr2.getElapsed(), 1 + index, TCPMon.ELAPSED_COLUMN);
+            		}
+            		
+                // Only loop as long as the connection to the target
+                // machine is available - once that's gone we can stop.
+                // The old way, loop until both are closed, left us
+                // looping forever since no one closed the 1st one.
+            	
+                if ((null != rr1) && rr1.isDone()) {
+                    if ((index >= 0) && (rr2 != null)) {
+                        listener.tableModel.setValueAt(
+                                TCPMon.getMessage("resp00", "Resp"), 1 + index,
+                                TCPMon.STATE_COLUMN);
+                    }
+                    rr1 = null;
+                }
+
+                if ((null != rr2) && rr2.isDone()) {
+                    if ((index >= 0) && (rr1 != null)) {
+                        listener.tableModel.setValueAt(
+                                TCPMon.getMessage("req00", "Req"), 1 + index,
+                                TCPMon.STATE_COLUMN);
+                    }
+                    rr2 = null;
+                }
+
+                synchronized (this) {
+                    this.wait(100);    // Safety just incase we're not told to wake up.
+                }
+            }
+
+            active = false;
+
+            if (index >= 0) {
+                listener.tableModel.setValueAt(
+                        TCPMon.getMessage("done00", "Done"),
+                        1 + index, TCPMon.STATE_COLUMN);
+            }
+
+        } catch (Exception e) {
+            StringWriter st = new StringWriter();
+            PrintWriter wr = new PrintWriter(st);
+            int index = listener.connections.indexOf(this);
+            if (index >= 0) {
+                listener.tableModel.setValueAt(
+                        TCPMon.getMessage("error00", "Error"), 1 + index,
+                        TCPMon.STATE_COLUMN);
+            }
+            e.printStackTrace(wr);
+            wr.close();
+            if (outputText != null) {
+                outputText.append(st.toString());
+            } else {
+                // something went wrong before we had the output area
+                System.out.println(st.toString());
+            }
+            halt();
+        }
+    }
+
+    /**
+     * Method wakeUp
+     */
+    synchronized void wakeUp() {
+        this.notifyAll();
+    }
+
+    /**
+     * Method halt
+     */
+    public void halt() {
+        try {
+            if (rr1 != null) {
+                rr1.halt();
+            }
+            if (rr2 != null) {
+                rr2.halt();
+            }
+            if (inSocket != null) {
+                inSocket.close();
+            }
+            inSocket = null;
+            if (outSocket != null) {
+                outSocket.close();
+            }
+            outSocket = null;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Method remove
+     */
+    public void remove() {
+        int index = -1;
+        try {
+            halt();
+            index = listener.connections.indexOf(this);
+            listener.tableModel.removeRow(index + 1);
+            listener.connections.remove(index);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: webservices/commons/trunk/modules/tcpmon/src/org/apache/ws/commons/tcpmon/Connection.java
------------------------------------------------------------------------------
    svn:eol-style = native