Can httptest be used to test HTTP/2? - go

I'm wondering if this (httptest) package can be used to test HTTP/2 specific features.
Can anyone point me to some examples maybe?
I'm aware of the tool h2i, but it's an interactive tool.
I'm looking for something which is programmable.
EDIT:
What I'm really looking for is a tool, where for example I can initiate a server push and test it on the client side.
So, using this package, how do I have access to the underlying HTTP/2 stuff it uses by default?
EDIT 2:
Found some examples in the nghttp2 source:
https://github.com/tatsuhiro-t/nghttp2/tree/master/integration-tests
EDIT 3:
For me it looks like that the package net/http2 isn't meant to be used directly by anyone. I'll experiment with this one.

General testing tip (to avoid frustration)!
Don't use Fiddler to test it, it gets in between your browser and the server and breaks the HTTP2 connection.
No HTTP2 - no push.

https://github.com/summerwind/h2spec is a go program that tests whether a server implementation conforms to RFC 7540. It allows to craft individual HTTP/2 frames such as:
settings := http2.Setting{http2.SettingInitialWindowSize, 0}
http2Conn.fr.WriteSettings(settings)
or
var hp http2.HeadersFrameParam
hp.StreamID = 1
hp.EndStream = false
hp.EndHeaders = true
hp.BlockFragment = http2Conn.EncodeHeader(hdrs)
http2Conn.fr.WriteHeaders(hp)

Related

load testing with websockets -JMeter?

From what I have found and tested, you can use the WebSocket Sampler for Apache JMeter, however you cannot record your test requests because the WebSocket request will not be passed appropriately through and back from the Java Proxy Server.
So, what are my options? I can build every request by hand instead of recording - and keep using JMeter -very tedious.
Build a new WebSocket Sampler?
Build onto the Java Proxy Server?
Or use something besides JMeter?
Before I dive into another deep pit, a little good advice would be much appreciated! Thank you so much!

Create local disk that when accessed sends a http request

So, my issue is as follows:
I need to create an .exe file that, when ran:
1: Creates a local disk in the Computer(say S)-this absolutely 100% needs to be considered local by the system.
2: Whenever S:{idlist} is accessed, create http request to a server: www.server.com:{idlist}. Response is in JSON. Return this response to whatever running app accessed S:{idlist}.
If possible guide me to what i should do to achieve this.(From what i know, it's doable in .NET, with C# or C++, tho i'm not sure exactly how).Any tips, documentation would be perfect.
Thank you and sorry for my english, not my native language and i'm only 15 y/o.

How do I implement CloudPort side logic? JScript or VBScript produce an ActiveX control fault (even when left dummy, with empty-body functions)

The team I am working with has bought a CloudPort license (from CrossCheck Networks) and we are currently facing the problem of not being able to implement any sort of logic in the service Mocks (to control response selection). It would be something as simple as:
if (requestCounter++ == 1)
then
response = $fn:Global(MyFirstXmlString)$ // <-- this is CloudP syntax for vrbls
else
response = $fn:Global(MySecondXmlString)$.
We did not find any sample for using the Dll Plugin and neither of the two JScript and VBScript Tasks are working (i.e., our client machine gets back not the desired MySecondXmlString response but instead a Fault with
<faultstring>
ActiveX control '0e59f1d5-1fbe-11d0-8ff2-00a0d10038bc' cannot be instantiated
because the current thread is not in a single-threaded apartment.
</faultstring>.
Believe it or not, the fault above is being obtained even if the J- or VB-Script task is left empty! It's hard for us to believe that all the logic functionality advertised in the CloudPort UI is fake and that nothing is able to help one implement the kind of logic described above.
Any help would be appreciated!
Thanks,
Pompi
PS: A bit more details here on why the kind of logic described above is needed: We use SoapSonar in our testing framework to fire requests to a BizTalk orchestration application. The CP mocks are needed to simulate the environment of that BT orchestration. We cannot control individual mocked responses via SSonar requests: the (for cloudport: incoming) client requests are made by Production code and cannot be altered or controled by our SSonar client). The only Tasks functionality that worked for us is a DB-table working as an offline channel b/w SSonar and CP (SSonar writes in it and CP reads from it). CloudPort's reading of, say, responseXml's, from DB works fine but we cannot find a way to implement further behavior controlling logic on the CP side. Therefore, this stackoverflow posting. And thx for having the patience to read this whole shananigan :).
Don't think you can control this from the script.
The threading model should be controlled by the host, which I suppose uses windows's "vbscript.dll" for the actual execution.
So if you cannot find any settings under the tool's options or in the help :), you should look in the registry keys for the threading options of that ActiveX or "vbscript.dll"
That is the "ThreadingModel" value and try to change the values (you will also have to search the net for those, don't know them by heart).
There are chances that some other application (antivirus?) has changes the path to the dll that the COM interface should actually point to (see http://social.technet.microsoft.com/Forums/en-US/ieitpropriorver/thread/ac10bd5f-6d91-4aac-857c-0ed5758088ec)
Hope it helps.

Creating proxy between application queries and Internet

Is it possible (for example with C++, but it does not really matter) to create a bridge/proxy application to get the data requested by another application? To be more detailed, I'm talking about a Adobe Air based game. (I want to create a report with stats based on the data acquired, but that is not actually part of this question.)
Rather than simple "boolean" answer please provide some link to example/documentation. Thanks
It would always be possible, and depending on the your target operating system, may require a fair amount of effort, which begs the question - is there a reason you cannot use Fiddler or some packet sniffing software for your target OS?
You can write a proxy by hand, in python can be quite easy. All you have to do is to set localhost as proxy, then forward the request and pass it back to the calling socket.
I've started writing something like this some times ago. The idea was to write a simple replacement for dansguardian.
I've uploaded it on github so you can give it a look if it can help.
I do not remember well (I've started writing it the last year) but maybe with some modification can fit well your requests.
Conceptually, this is your configuration:
app_client -> [app_channel] -> proxy -> [server_channel] -> app_server
Your proxy starts a server socket, the app_client connects to it. This is our app_channel. Now your proxy creates a connection to the app_server. This is your server_channel.
Now start 2 threads, one which reads from the app_channel and writes to the server_channel, the other reads from the server_channel and writes to the app_channel.
This will create a transparent connection to the app_server via your proxy. You can extract the data as you wish. If the data is encrypted though, there's very little you can actually do by way of analysis.

Apple Push Notification in Erlang (or improved in Ruby?)

I currently have an Apple Push Notification running on my server in Ruby. I'd like to get one going in Erlang as I'd like to use a supervisor to keep watch over it. Does anyone have any code that they could help me with?
Here's my Ruby code. One thing I do not like about this current implementation is that it does not seem to stay connected - it disconnects 2-3 times a day, and it seems after I reconnect that the first push will not go through:
context = OpenSSL::SSL::SSLContext.new
context.cert = OpenSSL::X509::Certificate.new(File.read(cert))
context.key = OpenSSL::PKey::RSA.new(File.read(cert))
def connect_sockets(server, context)
sock = TCPSocket.new(server, 2195)
ssl = OpenSSL::SSL::SSLSocket.new(sock,context)
ssl.connect
return sock, ssl
end
sock, ssl = connect_sockets(server, context) # this is called to initially connect and also reconnect whenever disconnected.
If Erlang Push isn't doable then I wouldn't mind sticking to my Ruby one as long as I can keep my connections alive, and perhaps supervise it through Erlang. Does anyone know if any of this is possible?
This question on Apple Push Notifications with Erlang might also be useful for this one.
The HTTP Client (with SSL support) that ships with Erlang works reasonably well ( I can't say I have battle tested it ). The relevant documentation is available here.
1) Don't forget to perform an "inets:start()" in your application before attempting to do HTTP calls.
2) In my (small) experience, starting the 'inets' module seems to be a bit tricky: don't try starting it within your supervisor module or else your servers won't work. I usually do 'inets:start()' in the first server module of my application before any other servers requiring HTTP are.
3) To perform the 'push' operation, I guess you would need to use the 'stream' option.
You might also check out the apn_on_rails
project.
If you come up with an Erlang implementation, please consider sharing it with us :).

Resources