Jmeter Mail support - jmeter

I am trying to check my gmail with a mail reader sampler in jmeter and enabled both imap and pop3 in my gmail account.
Everytime I try to connect to gmail, I keep getting this error:
Response message: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: imap.gmail.com, 993; timeout -1;
nested exception is:
java.net.ConnectException: Connection timed out: connect
imaps://xyz#gmail.com#imap.gmail.com/INBOX[1]
I tried both SSL and TLS option at the bottom. I tried adding and leaving out the port.

Your configuration looks good (given you tick Use SSL radio) , most likely you are sitting behind a corporate proxy server so JMeter is not able to establish connection with the IMAP Gmail endpoint.
You can configure JMeter to use proxy for Internet access as described in Using JMeter behind a proxy User Manual chapter, just launch it as:
jmeter -H proxy_host -P proxy_port ...
For more information on working with email protocols in JMeter tests check out Load Testing Your Email Server: How to Send and Receive E-mails with JMeter article

Related

JMeter how to send email through MS Exchange?

For my machine, after logging in the windows system, the outlook logon automatically with Anonymous Authentication.
The outlook connects to Microsoft Exchange using HTTP, and connects using SSL only.
The principal name in the certificate is known when connecting to proxy servers.
Header:email.server.sample
The URL to connect to my proxy server for Exchange is known.
https://email.server.sample
"Negotiate Authentication" is used when connecting to the proxy server for Exchange.
Now, the question is, how can JMeter sends out the email with this kind of situation?
Out of the box JMeter can only send emails via SMTP protocol with SMTP Sampler and/or receive emails using POP3 and/or IMAP protocols with Mail Reader Sampler
If you have to work with Exchange protocol you basically have 2 options:
Send SOAP requests using HTTP Request sampler
Use a wrapper library, i.e. ews-java-api from the JSR223 Sampler or Java Request sampler

Tinyproxy and Proxyfier combination

I have a VPS with Tinyproxy installed, and I have my PC configured with Proxyfier. Protocols SOCKSv4 and SOCKSv5 doesn't work for me, and I need HTTPS protocol. But when I choose HTTPS protocol I'm getting this error:
43:04] Error : the proxy server cannot establish connection with www.google.com:80
The error may indicate that the proxy server doesn't support SSL connections.
It means that the proxy can be used for web browsing but it cannot work with Proxifier.
The proxy server reply header is:
HTTP/1.0 403 Access violation
Server: tinyproxy/1.8.3
Content-Type: text/html
Connection: close
[43:04] Test failed.
Could you suggest me a possible solution? Maybe another program that work's like Proxifier or another Proxy that support https authentication and easy to get working.

Getting this error: Only ASCII supported in headers (perhaps SSL was used?)

I am getting following error on using Jmeter recording controller:
ERROR - jmeter.protocol.http.proxy.Proxy: Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: Remote host closed connection during handshake
2013/10/29 14:02:08 ERROR - jmeter.protocol.http.proxy.Proxy: Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: Unrecognized SSL message, plaintext connection?
2013/10/29 14:02:40 ERROR - jmeter.protocol.http.proxy.Proxy: Not implemented (probably used https) java.lang.IllegalArgumentException: Only ASCII supported in headers (perhaps SSL was used?)
at org.apache.jmeter.protocol.http.proxy.HttpRequestHdr.parse(HttpRequestHdr.java:155)
at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:188)
Can someone help me debug this or explain me the root cause for this.
I believe that you can ignore these messages as they are likely to be caused by external URLs as per Recording HTTPS Traffic with JMeter guide
I suggest to retry your recording with monitoring of browser requests via HttpFox or Firebug Firefox plugins enabled to detect any external URLs which may cause these errors to appear. When you populate the list you can block these URLs via "URL Patterns to Exclude" field of JMeter HTTP Proxy server.

When should one use CONNECT and GET HTTP methods at HTTP Proxy Server?

I'm building a WebClient library. Now I'm implementing a proxy feature, so I am making some research and I saw some code using the CONNECT method to request a URL.
But checking it within my web browser, it doesn't use the CONNECT method but calls the GET method instead.
So I'm confused. When I should use both methods?
TL;DR a web client uses CONNECT only when it knows it talks to a proxy and the final URI begins with https://.
When a browser says:
CONNECT www.google.com:443 HTTP/1.1
it means:
Hi proxy, please open a raw TCP connection to google; any following
bytes I write, you just repeat over that connection without any
interpretation. Oh, and one more thing. Do that only if you talk to
Google directly, but if you use another proxy yourself, instead you
just tell them the same CONNECT.
Note how this says nothing about TLS (https). In fact CONNECT is orthogonal to TLS; you can have only one, you can have other, or you can have both of them.
That being said, the intent of CONNECT is to allow end-to-end encrypted TLS session, so the data is unreadable to a proxy (or a whole proxy chain). It works even if a proxy doesn't understand TLS at all, because CONNECT can be issued inside plain HTTP and requires from the proxy nothing more than copying raw bytes around.
But the connection to the first proxy can be TLS (https) although it means a double encryption of traffic between you and the first proxy.
Obviously, it makes no sense to CONNECT when talking directly to the final server. You just start talking TLS and then issue HTTP GET. The end servers normally disable CONNECT altogether.
To a proxy, CONNECT support adds security risks. Any data can be passed through CONNECT, even ssh hacking attempt to a server on 192.168.1.*, even SMTP sending spam. Outside world sees these attacks as regular TCP connections initiated by a proxy. They don't care what is the reason, they cannot check whether HTTP CONNECT is to blame. Hence it's up to proxies to secure themselves against misuse.
A CONNECT request urges your proxy to establish an HTTP tunnel to the remote end-point.
Usually is it used for SSL connections, though it can be used with HTTP as well (used for the purposes of proxy-chaining and tunneling)
CONNECT www.google.com:443
The above line opens a connection from your proxy to www.google.com on port 443.
After this, content that is sent by the client is forwarded by the proxy to www.google.com:443.
If a user tries to retrieve a page http://www.google.com, the proxy can send the exact same request and retrieve response for him, on his behalf.
With SSL(HTTPS), only the two remote end-points understand the requests, and the proxy cannot decipher them. Hence, all it does is open that tunnel using CONNECT, and lets the two end-points (webserver and client) talk to each other directly.
Proxy Chaining:
If you are chaining 2 proxy servers, this is the sequence of requests to be issued.
GET1 is the original GET request (HTTP URL)
CONNECT1 is the original CONNECT request (SSL/HTTPS URL or Another Proxy)
User Request ==CONNECT1==> (Your_Primary_Proxy ==CONNECT==> AnotherProxy-1 ... ==CONNECT==> AnotherProxy-n) ==GET1(IF is http)/CONNECT1(IF is https)==> Destination_URL
As a rule of thumb GET is used for plain HTTP and CONNECT for HTTPS
There are more details though so you probably want to read the relevant RFC-s
http://www.ietf.org/rfc/rfc2068.txt
http://www.ietf.org/rfc/rfc2817.txt
The CONNECT method converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.

handle CONNECT requests in a websocket server

My websocket server listens on port 8080 with no proxy.
Most of the time I'm getting requests with the Upgrade Websocket header and it works fine.
Sometimes I'm getting HTTP CONNECT requests.
Is this a valid request?
Does it means that there is a proxy server between the client and the server?
How my server is suppose to respond to the CONNECT request?
Thanks
You are getting CONNECT requests because you are likely to have configured your browser to use a proxy. If you directed your browser to use port 8080 on your local IP address, it will assume there is a proxy and that means when you ask for a secure connection, the browser leads with CONNECT.
You will need to add support for SSL/TLS tunnelling to your server to deal with this.

Resources