View | Details | Raw Unified | Return to bug 46436
Collapse All | Expand All

(-)/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java (+22 lines)
Lines 156-161 Link Here
156
    private boolean samplerDownloadImages;
156
    private boolean samplerDownloadImages;
157
157
158
    private boolean regexMatch = false;// Should we match using regexes?
158
    private boolean regexMatch = false;// Should we match using regexes?
159
    
160
    /*
161
     * Is JMeter running in Gui mode? 
162
     * Set by org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui
163
     */
164
    private boolean inGuiMode = false;
165
    
166
    
159
167
160
    /**
168
    /**
161
     * Tree node where the samples should be stored.
169
     * Tree node where the samples should be stored.
Lines 955-958 Link Here
955
    public boolean canRemove() {
963
    public boolean canRemove() {
956
        return null == server;
964
        return null == server;
957
    }
965
    }
966
    
967
	/**
968
	 * @return the inGuiMode
969
	 */
970
	public boolean isInGuiMode() {
971
		return inGuiMode;
972
	}
973
974
	/**
975
	 * @param inGuiMode the inGuiMode to set
976
	 */
977
	public void setInGuiMode(boolean inGuiMode) {
978
		this.inGuiMode = inGuiMode;
979
	}
958
}
980
}
(-)/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java (+13 lines)
Lines 19-30 Link Here
19
package org.apache.jmeter.protocol.http.proxy;
19
package org.apache.jmeter.protocol.http.proxy;
20
20
21
import java.io.InterruptedIOException;
21
import java.io.InterruptedIOException;
22
import java.net.BindException;
22
import java.net.ServerSocket;
23
import java.net.ServerSocket;
23
import java.net.Socket;
24
import java.net.Socket;
24
import java.util.Collections;
25
import java.util.Collections;
25
import java.util.HashMap;
26
import java.util.HashMap;
26
import java.util.Map;
27
import java.util.Map;
27
28
29
import javax.swing.JOptionPane;
30
28
import org.apache.jorphan.logging.LoggingManager;
31
import org.apache.jorphan.logging.LoggingManager;
29
import org.apache.jorphan.util.JOrphanUtils;
32
import org.apache.jorphan.util.JOrphanUtils;
30
import org.apache.log.Logger;
33
import org.apache.log.Logger;
Lines 153-158 Link Here
153
                }
156
                }
154
            }
157
            }
155
            log.info("Proxy Server stopped");
158
            log.info("Proxy Server stopped");
159
            
160
        } catch(BindException e){
161
        	// daemon port already in use
162
        	log.warn("Proxy Server stopped", e);
163
        	log.error("Port " + daemonPort + " already in use. Choose a different one for the proxy.");
164
       
165
        	//TODO: alert in console mode, too
166
        	if(target.isInGuiMode()){
167
        		JOptionPane.showMessageDialog(null, "Port " + daemonPort + " already in use. Choose a different one for the proxy.", "Proxy Server Port", JOptionPane.ERROR_MESSAGE);
168
        	}
156
        } catch (Exception e) {
169
        } catch (Exception e) {
157
            log.warn("Proxy Server stopped", e);
170
            log.warn("Proxy Server stopped", e);
158
        } finally {
171
        } finally {
(-)/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java (+3 lines)
Lines 196-201 Link Here
196
    public TestElement createTestElement() {
196
    public TestElement createTestElement() {
197
        model = makeProxyControl();
197
        model = makeProxyControl();
198
        log.debug("creating/configuring model = " + model);
198
        log.debug("creating/configuring model = " + model);
199
        model.setInGuiMode(true);
199
        modifyTestElement(model);
200
        modifyTestElement(model);
200
        return model;
201
        return model;
201
    }
202
    }
Lines 220-225 Link Here
220
        configureTestElement(el);
221
        configureTestElement(el);
221
        if (el instanceof ProxyControl) {
222
        if (el instanceof ProxyControl) {
222
            model = (ProxyControl) el;
223
            model = (ProxyControl) el;
224
            model.setInGuiMode(true);
223
            model.setPort(portField.getText());
225
            model.setPort(portField.getText());
224
            setIncludeListInProxyControl(model);
226
            setIncludeListInProxyControl(model);
225
            setExcludeListInProxyControl(model);
227
            setExcludeListInProxyControl(model);
Lines 371-376 Link Here
371
        modifyTestElement(model);
373
        modifyTestElement(model);
372
        try {
374
        try {
373
            replacer.replaceValues(model);
375
            replacer.replaceValues(model);
376
            model.setInGuiMode(true);
374
            model.startProxy();
377
            model.startProxy();
375
            start.setEnabled(false);
378
            start.setEnabled(false);
376
            stop.setEnabled(true);
379
            stop.setEnabled(true);

Return to bug 46436