In my application, I am scheduling Mobile Application tests for clients app. using Browserstack.
Unfortunately, when client is running the test on his local computer, he is unable to establish connection with Browserstack. It occurred that all "non-internal" traffic is going thru NTLM proxy so my app can`t create direct connection to BS.
I was trying to change config files settings to use default proxy, but it didnt helped - I get 407 authorization error.
Currently I`m trying to make it working in the code directly, but with no luck. Moreover i read that AppiumDriver is not using any proxy related settings.
var proxy = new Proxy();
proxy.Kind = ProxyKind.AutoDetect;
proxy.IsAutoDetect = true;
AppiumOptions caps = new AppiumOptions();
caps.AddAdditionalCapability("browserstack.user", "user");
caps.AddAdditionalCapability("browserstack.key", "key");
caps.AddAdditionalCapability("device", "Samsung Galaxy S8");
caps.AddAdditionalCapability("os_version", "7.0");
caps.AddAdditionalCapability("name", string.Format("Requested
time: {0}", DateTime.Now));
caps.AddAdditionalCapability("realMobile", true);
caps.AddAdditionalCapability("browserstack.idleTimeout", 300);
caps.AddAdditionalCapability("app", "MobileAppName");
caps.AddAdditionalCapability("ACCEPT_SSL_CERTS", true);
caps.Proxy = proxy;
try
{
return new
AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>(
new Uri("https://hub-cloud.browserstack.com/wd/hub"), caps);
}
catch (Exception e)
{
throw new Exception($"Couldn't create browserstack
instance. {e.Message + e.StackTrace}");
}
}
What I want to achieve is to force Appium Driver to use proxy and credentials defined on client`s computer to make connection with Browserstack hub.
Any suggestions are welcome as I`m struggling with the issue far too long now.
It seems Appium itself does not support passing proxy details programmatically. Relevant links for the same - #1, #2, #3
You may try to whitelist the BrowserStack Hub address in your client machine to connect to BrowserStack hub.
Related
I am writing a blazor server side application (.NET6) for my homeautomation and let it run on iis on a home server.
If I run the following code on my local machine in IIS Express everything works fine.
string _urlForecast = "https://api.openweathermap.org/data/2.5/forecast?id=...";
Uri myUri = new Uri(_urlForecast, UriKind.Absolute);
HttpResponseMessage response = await HttpClient.GetAsync(myUri);
var data = await response.Content.ReadAsStringAsync()
If I deploy it to my local homeserver and run it I get the following error:
System.Net.Http.HttpRequestException: No such host is known. (api.openweathermap.org:443)
My 'homeserver' is also running windows 10 and is in the same network as my dev pc.
It is in the same ip range and has the same DNS settings on the network adapter.
I also tried it with turned off firewall with the same result.
I am injecting the httpClient with DI but also tried without DI.
I tried to use http://api... and https://api... as my application is also available in the internal network via https. Unfortunately I have don't have any experience with Http requests and would be thankful if anybody could help.
I want to make an API call (outside my organization domain) in my existing application, the network team has told me to set up a proxy config - only then it'd have the ability to go to the internet.
Dev has the ability to go to the internet without referencing the proxy setup.
In my dev environment, it is working fine since the ports are open, how to configure a proxy for UAT environment so that it can hit the new target on the internet?
proxy IP is given by the network team for Non-prod: 12.XXX.XXX.0 Port 80
and also how to check:
if the above proxy is alive?
once it is configured how to check if the request is going through the
proxy because I just have dev server access where all ports are open,
how would I check if it is configured correctly so that once deployed
on UAT it works fine?
The HttpWebRequest has a proxy property:
var myWebRequest = (HttpWebRequest)WebRequest.Create("url");
myWebRequest.Proxy = new WebProxy("host", 80);
try
{
var response = myWebRequest.GetResponse();
//...
}
catch (WebException e)
{
// handling issues
}
If a request fails, an exception will be thrown that you can handle in catch block.
This is my first post here, I've looked across the internet in order to solve this issue but have no idea how to do this, as i am new to docker and not that great at networking (saying kindly).
I need a way to access my host machines internal network IP which has been forwarded to a port that connects to a proxy server. so essentially 192.168.x.xx:5000 => someproxyserver.com
now when setting up the SOCKS5 on my local machine or even in C# it is able to connect and it works.
but this is not the case with docker, again i am complete noob at docker, i have tried many things, but i can't seem to get my docker container to connect to the socks5 server.
I even tried to run the docker container with --network=host but i get an error (no route to host)
Ideally i would not want to use --network host as i have many other containers connecting to a external network.
var settings = new ProxySettings() {
Host = localIp,
Port = port
};
using (var proxyClientHandler = new ProxyClientHandler<Socks5>(settings)) {
using (var httpClient = new HttpClient(proxyClientHandler)) {
var response = await httpClient.GetStringAsync("https://api.ipify.org?format=json");
}
}
this is the C# code which i am using to connect to the SOCKS5 server.
When using --network=host
without --network=host
I managed to make this work somehow, without including any run commands, i believe this was failing due to my firewall blocking access, it was weird as i did allow access to it, however after restarting my computer earlier on, it worked :) so yeah if anyone stumbles across this, just remember to make sure your firewall isn't blocking access to docker
I am going to build application (Asp.net C#) to connect RabbitMQ server which is in another country.
So my question is how to connect that server.
I already installed RabbitMQ Client from NuGet Packages.
Is that needed to run RabbitMQ service in my local machine ?
Need to install RabbitMQ Server in my local machine?
From Client some of the parameters i got like
UserName, Password, HostName, Certificate with private key.
I am curious to know which are the basic steps to connect that server from my localhost application.
Can someone provide blog to refer ?
I already tried with different steps but not able to connect.
string vCertSubjectName = "CN=DevRepo, OU=IT, O=OLX, L=KTM, S=Surrey, C=UK";
ConnectionFactory factory = new ConnectionFactory();
factory.AuthMechanisms = new AuthMechanismFactory[] { new ExternalMechanismFactory() };
factory.HostName = "195.168.0.15";
factory.Port = 5673;
factory.Ssl.Certs = getCertificate(vCertSubjectName);
factory.Ssl.ServerName = System.Net.Dns.GetHostName();
factory.Ssl.Enabled = true;
factory.Ssl.Version = SslProtocols.Tls12;
IConnection connection = factory.CreateConnection();
Error coming like connection.start was never received, likely due to a network timeout."
There are very good simple examples of how to write code to send and receive messages to/from RabbitMQ on their site.
Get those examples; set up a RabbitMQ server on your local network; build the examples and verify they work. Once you know how to send/receive to/from a known instance, you can change the connection properties in your send program to point it to the RabbitMQ instance elsewhere.
I would also suggest you do a ping to the IP address of the foreign RabbitMQ server to get an idea of actual transit times. That should give you some idea if the network timeout is a valid issue.
PS. You will need a valid login and password for the RabbitMQ server before it will accept any messages from you. When you build the example programs above as long as you are on the same physical machine where RabbitMQ is running, you can use the default login and password of guest/guest. By default this will NOT work from another machine due to default security configuration of RabbitMQ.
I’ve written a WS server from scratch and I’m trying to host it on AWS Elastic Beanstalk service. However, I’ve only figured a way to add it to a web project (that can be hosted on EB) by tacking it on with a thread on startup.cs:
Thread thr = new Thread(() =>
{
var ws = new WebsocketServer();
});
thr.IsBackground = true;
thr.Start();
To my delight and surprise, I was able to successfully test this locally and it works perfectly fine, but when put on EB I am unable to connect to anything (even though I am 99% certain I’m sending requests to the appropriate URL). I’ve tried adding the port I’ve specified but nothing helps.
I’m using a TcpListener initialized like this:
TcpListener server = new TcpListener(IPAddress.Parse(“127.0.0.1”), 443);
server.Start();
And accept clients with a TcpClient like so:
TcpClient client = new TcpClient();
client = server.AcceptTcpClient();
Now based on my experience I assume that the connection is working properly but EB simply does not automatically set it up for public access. Is there any way to do this? Would using the same port as the web app help? (If so, how do I set/see what port it does use?). Since WS is initiated with a HTTP request, is there possibly a way to establish a connection using a Controller method of the format:
[Route("ws")]
[HttpGet]
public async Task<IActionResult> ConnectWS()
{
return await AddClient();
}
I have no Load Balancer set up for the EB environment I'm using.
Lastly, if this is a bad practice or infeasible, is there another AWS service I could use to host the server that’s easy to set up for public connections?
Thank you!
Looking at your code, you need to open up traffic on port 443. Depending on your Elastic Beanstalk configuration ( with load balancer? or without load balancer? update your question with this please ) you are close to getting it to work on AWS.
These high level steps will get you there:
Get a cert. For testing you can install openSSL on your local dev machine and create a self-signed cert. AWS has a guide on how to do this. Note: don't use self-signed certs on your live production system. When your site goes public, obtain a catchy name and a real cert to front your service.
(If no load balancer skip to step 3) Go to Certification Manager in your AWS console. There is a big blue button, Import Certficiate. Click this. Open the server.crt file from step 1 with your favorite text editor and paste the contents in the top box with the label: Certificate body. Then open the privatekey.cer file from step 2 with your favorite text editor and paste the contents in the second box with the label: Certificate private key. Click Review and Import and make sure everything is ok
If you have a load balancer, follow the steps from this AWS guide on how to open up 443 on it.. If you don't have a load balancer and it is just a single instance, its a bit more complicated as you have to do it via configuration files. Follow the steps here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance.html
Try it out and reply back if you have updates to your question with more config specifics. I think you are close to working it out and getting it running on AWS.