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

(-)docs/usermanual/component_reference.html (+14 lines)
Lines 4353-4358 Link Here
4353
<br>
4353
<br>
4354
4354
4355
4355
4356
        Secure sockets (<tt>javax.net.ssl.SSLSocket</tt>) are supported. When "SSL" is selected, the socket will be opened
4357
        as a SSLSocket. When SSL is used, JMeter must be configured with appropriate <tt>javax.net.ssl.*</tt> system properties.
4358
        
4359
<br>
4360
4361
4356
        If "Re-use connection" is selected, connections are shared between Samplers in the same thread,
4362
        If "Re-use connection" is selected, connections are shared between Samplers in the same thread,
4357
        provided that the exact same host name string and port are used. 
4363
        provided that the exact same host name string and port are used. 
4358
        Different hosts/port combinations will use different connections, as will different threads. 
4364
        Different hosts/port combinations will use different connections, as will different threads. 
Lines 4600-4605 Link Here
4600
</td>
4606
</td>
4601
</tr>
4607
</tr>
4602
<tr>
4608
<tr>
4609
<td>SSL</td>
4610
<td>If selected, the connection is opened using <tt>javax.net.ssl.SSLSocket</tt>. Otherwise <tt>java.net.Socket</tt> is used.
4611
</td>
4612
<td>
4613
No
4614
</td>
4615
</tr>
4616
<tr>
4603
<td>Re-use connection</td>
4617
<td>Re-use connection</td>
4604
<td>If selected, the connection is kept open. Otherwise it is closed when the data has been read.
4618
<td>If selected, the connection is kept open. Otherwise it is closed when the data has been read.
4605
</td>
4619
</td>
(-)src/core/org/apache/jmeter/resources/messages.properties (+1 lines)
Lines 1183-1188 Link Here
1183
userdn=Username
1183
userdn=Username
1184
username=Username
1184
username=Username
1185
userpw=Password
1185
userpw=Password
1186
usessl=SSL
1186
value=Value
1187
value=Value
1187
value_to_quote_meta=Value to escape from ORO Regexp meta chars
1188
value_to_quote_meta=Value to escape from ORO Regexp meta chars
1188
var_name=Reference Name
1189
var_name=Reference Name
(-)src/protocol/tcp/org/apache/jmeter/protocol/tcp/config/gui/TCPConfigGui.java (+28 lines)
Lines 52-57 Link Here
52
    private JLabeledTextField classname;
52
    private JLabeledTextField classname;
53
53
54
    private JCheckBox reUseConnection;
54
    private JCheckBox reUseConnection;
55
    
56
    private JCheckBox useSsl;
55
57
56
    // NOTUSED yet private JTextField filename;
58
    // NOTUSED yet private JTextField filename;
57
59
Lines 89-94 Link Here
89
        serverPanel.setServer(element.getPropertyAsString(TCPSampler.SERVER));
91
        serverPanel.setServer(element.getPropertyAsString(TCPSampler.SERVER));
90
        // Default to original behaviour, i.e. re-use connection
92
        // Default to original behaviour, i.e. re-use connection
91
        reUseConnection.setSelected(element.getPropertyAsBoolean(TCPSampler.RE_USE_CONNECTION, TCPSampler.RE_USE_CONNECTION_DEFAULT));
93
        reUseConnection.setSelected(element.getPropertyAsBoolean(TCPSampler.RE_USE_CONNECTION, TCPSampler.RE_USE_CONNECTION_DEFAULT));
94
        useSsl.setSelected(element.getPropertyAsBoolean(TCPSampler.USE_SSL, TCPSampler.USE_SSL_DEFAULT));
92
        serverPanel.setPort(element.getPropertyAsString(TCPSampler.PORT));
95
        serverPanel.setPort(element.getPropertyAsString(TCPSampler.PORT));
93
        // filename.setText(element.getPropertyAsString(TCPSampler.FILENAME));
96
        // filename.setText(element.getPropertyAsString(TCPSampler.FILENAME));
94
        serverPanel.setResponseTimeout(element.getPropertyAsString(TCPSampler.TIMEOUT));
97
        serverPanel.setResponseTimeout(element.getPropertyAsString(TCPSampler.TIMEOUT));
Lines 122-127 Link Here
122
        element.setProperty(TCPSampler.CLASSNAME, classname.getText(), "");
125
        element.setProperty(TCPSampler.CLASSNAME, classname.getText(), "");
123
        element.setProperty(TCPSampler.SERVER, serverPanel.getServer());
126
        element.setProperty(TCPSampler.SERVER, serverPanel.getServer());
124
        element.setProperty(TCPSampler.RE_USE_CONNECTION, reUseConnection.isSelected());
127
        element.setProperty(TCPSampler.RE_USE_CONNECTION, reUseConnection.isSelected());
128
        element.setProperty(TCPSampler.USE_SSL, useSsl.isSelected());
125
        element.setProperty(TCPSampler.PORT, serverPanel.getPort());
129
        element.setProperty(TCPSampler.PORT, serverPanel.getPort());
126
        // element.setProperty(TCPSampler.FILENAME, filename.getText());
130
        // element.setProperty(TCPSampler.FILENAME, filename.getText());
127
        setNoDelay.setPropertyFromTristate(element, TCPSampler.NODELAY);
131
        setNoDelay.setPropertyFromTristate(element, TCPSampler.NODELAY);
Lines 146-151 Link Here
146
        classname.setText(""); //$NON-NLS-1$
150
        classname.setText(""); //$NON-NLS-1$
147
        requestData.setInitialText(""); //$NON-NLS-1$
151
        requestData.setInitialText(""); //$NON-NLS-1$
148
        reUseConnection.setSelected(true);
152
        reUseConnection.setSelected(true);
153
        useSsl.setSelected(false);
149
        setNoDelay.setSelected(false); // TODO should this be indeterminate?
154
        setNoDelay.setSelected(false); // TODO should this be indeterminate?
150
        closeConnection.setSelected(TCPSampler.CLOSE_CONNECTION_DEFAULT); // TODO should this be indeterminate?
155
        closeConnection.setSelected(TCPSampler.CLOSE_CONNECTION_DEFAULT); // TODO should this be indeterminate?
151
        soLinger.setText(""); //$NON-NLS-1$
156
        soLinger.setText(""); //$NON-NLS-1$
Lines 186-191 Link Here
186
        closePortPanel.add(reUseConnection);
191
        closePortPanel.add(reUseConnection);
187
        return closePortPanel;
192
        return closePortPanel;
188
    }
193
    }
194
    
195
    private JPanel createUseSslPanel() {
196
        JLabel label = new JLabel(JMeterUtils.getResString("usessl")); //$NON-NLS-1$
197
198
        useSsl = new JCheckBox("", true);
199
//        useSsl.addItemListener(new ItemListener() {
200
//            @Override
201
//            public void itemStateChanged(final ItemEvent e) {
202
//                if (e.getStateChange() == ItemEvent.SELECTED) {
203
//                    closeConnection.setEnabled(true);
204
//                } else {
205
//                    closeConnection.setEnabled(false);
206
//                }
207
//            }
208
//        });
209
        label.setLabelFor(useSsl);
210
211
        JPanel panel = new JPanel(new FlowLayout());
212
        panel.add(label);
213
        panel.add(useSsl);
214
        return panel;
215
    }
189
216
190
    private JPanel createCloseConnectionPanel() {
217
    private JPanel createCloseConnectionPanel() {
191
        JLabel label = new JLabel(JMeterUtils.getResString("closeconnection")); // $NON-NLS-1$
218
        JLabel label = new JLabel(JMeterUtils.getResString("closeconnection")); // $NON-NLS-1$
Lines 272-277 Link Here
272
        HorizontalPanel optionsPanel = new HorizontalPanel();
299
        HorizontalPanel optionsPanel = new HorizontalPanel();
273
        optionsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder()));
300
        optionsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder()));
274
        optionsPanel.add(createClosePortPanel());
301
        optionsPanel.add(createClosePortPanel());
302
        optionsPanel.add(createUseSslPanel());
275
        optionsPanel.add(createCloseConnectionPanel());
303
        optionsPanel.add(createCloseConnectionPanel());
276
        optionsPanel.add(createNoDelayPanel());
304
        optionsPanel.add(createNoDelayPanel());
277
        optionsPanel.add(createSoLingerOption());
305
        optionsPanel.add(createSoLingerOption());
(-)src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java (-1 / +14 lines)
Lines 36-41 Link Here
36
import java.util.Properties;
36
import java.util.Properties;
37
import java.util.Set;
37
import java.util.Set;
38
38
39
import javax.net.ssl.SSLSocketFactory;
40
39
import org.apache.commons.lang3.StringUtils;
41
import org.apache.commons.lang3.StringUtils;
40
import org.apache.jmeter.config.ConfigTestElement;
42
import org.apache.jmeter.config.ConfigTestElement;
41
import org.apache.jmeter.samplers.AbstractSampler;
43
import org.apache.jmeter.samplers.AbstractSampler;
Lines 84-89 Link Here
84
    public static final String RE_USE_CONNECTION = "TCPSampler.reUseConnection"; //$NON-NLS-1$
86
    public static final String RE_USE_CONNECTION = "TCPSampler.reUseConnection"; //$NON-NLS-1$
85
    public static final boolean RE_USE_CONNECTION_DEFAULT = true;
87
    public static final boolean RE_USE_CONNECTION_DEFAULT = true;
86
88
89
    public static final String USE_SSL = "TCPSampler.useSsl"; //$NON-NLS-1$
90
    public static final boolean USE_SSL_DEFAULT = false;
91
87
    public static final String CLOSE_CONNECTION = "TCPSampler.closeConnection"; //$NON-NLS-1$
92
    public static final String CLOSE_CONNECTION = "TCPSampler.closeConnection"; //$NON-NLS-1$
88
    public static final boolean CLOSE_CONNECTION_DEFAULT = false;
93
    public static final boolean CLOSE_CONNECTION_DEFAULT = false;
89
94
Lines 176-182 Link Here
176
            try {
181
            try {
177
                closeSocket(socketKey); // Bug 44910 - close previous socket (if any)
182
                closeSocket(socketKey); // Bug 44910 - close previous socket (if any)
178
                SocketAddress sockaddr = new InetSocketAddress(getServer(), getPort());
183
                SocketAddress sockaddr = new InetSocketAddress(getServer(), getPort());
179
                con = new Socket();
184
                if (getPropertyAsBoolean(USE_SSL)) {
185
                    con = SSLSocketFactory.getDefault().createSocket();
186
                } else {
187
                    con = new Socket();
188
                }
180
                if (getPropertyAsString(SO_LINGER,"").length() > 0){
189
                if (getPropertyAsString(SO_LINGER,"").length() > 0){
181
                    con.setSoLinger(true, getSoLinger());
190
                    con.setSoLinger(true, getSoLinger());
182
                }
191
                }
Lines 236-241 Link Here
236
        return getPropertyAsBoolean(RE_USE_CONNECTION, RE_USE_CONNECTION_DEFAULT);
245
        return getPropertyAsBoolean(RE_USE_CONNECTION, RE_USE_CONNECTION_DEFAULT);
237
    }
246
    }
238
247
248
    public boolean isUseSsl() {
249
        return getPropertyAsBoolean(USE_SSL, USE_SSL_DEFAULT);
250
    }
251
239
    public void setCloseConnection(String close) {
252
    public void setCloseConnection(String close) {
240
        this.setProperty(CLOSE_CONNECTION, close, "");
253
        this.setProperty(CLOSE_CONNECTION, close, "");
241
    }
254
    }

Return to bug 57539