Do you know what can I do to check if proxy in WebBrowser is working properly?
Well, if the proxy does not exist, you will have an error:
WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_8, "localhost", 8080);
HtmlPage page = webClient.getPage("http://htmlunit.sf.net");
System.out.println(page.asText());
org.apache.http.conn.HttpHostConnectException:
Connection to http://localhost:8080
refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:127)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147)
If the proxy misbehaves, you will have a different page than what you expected
Related
Ratchet worked perfect until I updated my composer, after that it produce this error on chrome
WebSocket connection to 'wss://mysite.com/wss2/' failed: Error during WebSocket handshake: Unexpected response code: 302
on Mozilla
Firefox can’t establish a connection to the server at wss://mysite.com/wss2/.
httpd.conf
ProxyPass /wss2/ ws://myIP:8888/
socket.js
var conn = new ab.Session('wss://mysite.com/wss2/',
Does anyone know what might be the problem? thanks!
I have an application which automatically login using my windows domain credentials. I tried with the below in Jmeter.
HTTP Request
HTTP Header manager(Authorization with Basic encoded string)
I am getting below response
Response code: 500
Response message: Internal Server Error
I was able to view content on browser. I tried the same with java code as below
CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));
Authenticator.setDefault(new MyAuthenticator("username", "password"));
URL url = new URL("http://someurl");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
This gives me 200 OK response.
Please let me know how to achieve this through Jmeter. Thanks in advance!
Try adding HTTP Authorization Manager in your jmeter test suite and enter your credentials there.This will likely solve your problem
My push java app is behind a web proxy. I used below code to set proxy:
ProxyManager.setProxy("", "");
After executed, I got:
javapns.communication.exceptions.CommunicationException: Communication exception: java.io.IOException: Unable to tunnel through. Proxy returns "HTTP/1.1 403 Proxy Error"
Please guide me how to solve this issue.
If there is a username and password required for the proxy, then you also need to set the proxyAuthorization of the ProxyManager.
To encode the username and password, you can use the existing encodeProxyAuthorization method of the ProxyManager:
String encodeProxyAuthorization = ProxyManager.encodeProxyAuthorization(username, password);
ProxyManager.setProxyAuthorization(encodeProxyAuthorization);
We are using HtmlUnit Version 2.11 i.e. the latest version
If we pass a url with https protocol to webClient.getPage it thows the following exception and fails to work
#Test
public void TC001_VerifyHomePageLaunch() throws Exception {
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_10);
final HtmlPage page = webClient.getPage("https://localhost/abc/test.jsp");
webClient.closeAllWindows();
}
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
Please help us with the steps on how to get rid of this error and go ahead with actual testing.
We don't have certificates installed as this is a test machine.
Try the following setting with your WebClient:
webClient.setUseInsecureSSL(true)
Documenation states:
If set to true, the client will accept connections to any host, regardless of whether they have valid certificates or not. This is especially useful when you are trying to connect to a server with expired or corrupt certificates.
Link to source.
Is it possible for a firefox addon to establish a websocket connections?
When I try:
var wsUri = "ws://echo.websocket.org/";
var ws = gBrowser.contentWindow.window.WebSocket ||
gBrowser.contentWindow.window.MozWebSocket;
var websocket = new ws(wsUri);
In the Error Console the message says
Error: Firefox can't establish a connection to the server at ws://echo.websocket.org/.
Currently, it seems the only option is to proxy your WebSocket messages through a PageWorker. There is an example of how to do this on this website:
http://austinhartzheim.me/blog/4/websockets-firefox-sdk-addons/