You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/12/06 17:56:56 UTC

svn commit: r1042720 - in /jakarta/jmeter/trunk/src: core/org/apache/jmeter/util/SlowSocket.java protocol/http/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java

Author: sebb
Date: Mon Dec  6 16:56:56 2010
New Revision: 1042720

URL: http://svn.apache.org/viewvc?rev=1042720&view=rev
Log:
Initial impl. of Slow Sockets for Apache HC

Added:
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java   (with props)
Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowSocket.java

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowSocket.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowSocket.java?rev=1042720&r1=1042719&r2=1042720&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowSocket.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowSocket.java Mon Dec  6 16:56:56 2010
@@ -85,6 +85,16 @@ public class SlowSocket extends Socket {
         CPS=cps;
     }
 
+    /**
+     * Added for use by SlowHC4SocketFactory.
+     * 
+     * @param cps
+     */
+    public SlowSocket(int cps) {
+        super();
+        CPS = cps;
+    }
+
     // Override so we can intercept the stream
     @Override
     public OutputStream getOutputStream() throws IOException {

Added: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java?rev=1042720&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java (added)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java Mon Dec  6 16:56:56 2010
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.protocol.http.util;
+
+import java.net.Socket;
+
+import org.apache.http.conn.scheme.PlainSocketFactory;
+import org.apache.http.params.HttpParams;
+import org.apache.jmeter.util.SlowSocket;
+
+/**
+ * Apache HttpClient protocol factory to generate "slow" sockets for emulating dial-up modems
+ */
+
+public class SlowHC4SocketFactory extends PlainSocketFactory {
+
+    private final int CPS; // Characters per second to emulate
+
+    /**
+     * Create a factory 
+     * @param cps - characters per second
+     */
+    public SlowHC4SocketFactory(final int cps) {
+        super();
+        CPS = cps;
+    }
+
+    @Override
+    public Socket createSocket(final HttpParams params) {
+        return new SlowSocket(CPS);
+    }
+
+    @Override
+    public Socket createSocket() {
+        return new Socket();
+    }
+    
+}

Propchange: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org