Мне нужно использовать удаленный прокси-сервер для моего теста, но прокси-сервер требует логин и пароль для авторизации. Я пытаюсь использовать BrowserMobProxyServer
для этого:
BrowserMobProxy bmp = new BrowserMobProxyServer();
bmp.start();
// This inject my remote proxy ip:port and login password.
bmp.autoAuthorization("111.111.111.111:8000", "l0gVal", "pasVal", AuthType.BASIC);
Proxy proxy = ClientUtil.createSeleniumProxy(bmp);
// I guess if info about this proxy already injected it should work without loin & password form but auth alert whenever appear(
proxy.setHttpProxy("111.111.111.111:8000");
proxy.setSslProxy("111.111.111.111:8000");
ChromeOptions options = new ChromeOptions();
options.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new ChromeDriver(options);
driver.get("https://whoer.net");
Помогите мне понять мою ошибку, я уверен, что это возможно, но как.
Я получаю это исключение:
тартинг ChromeDriver 2.35.528157
(4429ca2590d6988c0745c24c8858745aaaec01ef) через порт 30000 только локальный
Соединения разрешены. 2018-04-26 11:45:22 ОШИБКА
o.l.p.impl.ClientToProxyConnection - (AWAITING_INITIAL) в
net.lightbody.bmp.util.BrowserMobHttpUtil.removeMatchingPort (BrowserMobHttpUtil.java:274)
~ [browsermob-core-2.1.0-beta-6.jar: na] в
net.lightbody.bmp.filters.HttpsHostCaptureFilter.clientToProxyRequest (HttpsHostCaptureFilter.java:36)
~ [browsermob-core-littleproxy-2.1.0-beta-6.jar: na] в
net.lightbody.bmp.filters.BrowserMobHttpFilterChain.clientToProxyRequest (BrowserMobHttpFilterChain.java:65)
~ [browsermob-core-littleproxy-2.1.0-beta-6.jar: na] в
org.littleshoot.proxy.impl.ClientToProxyConnection.doReadHTTPInitial (ClientToProxyConnection.java:227)
~ [littleproxy-1.1.0-beta-bmp-12.jar: na] в
org.littleshoot.proxy.impl.ClientToProxyConnection.readHTTPInitial (ClientToProxyConnection.java:191)
~ [littleproxy-1.1.0-beta-bmp-12.jar: na] в
org.littleshoot.proxy.impl.ClientToProxyConnection.readHTTPInitial (ClientToProxyConnection.java:80)
~ [littleproxy-1.1.0-beta-bmp-12.jar: na] в
org.littleshoot.proxy.impl.ProxyConnection.readHTTP (ProxyConnection.java:135)
~ [littleproxy-1.1.0-beta-bmp-12.jar: na] в
org.littleshoot.proxy.impl.ProxyConnection.read (ProxyConnection.java:120)
~ [littleproxy-1.1.0-beta-bmp-12.jar: na] в
org.littleshoot.proxy.impl.ProxyConnection.channelRead0 (ProxyConnection.java:587)
~ [littleproxy-1.1.0-beta-bmp-12.jar: na] в
io.netty.channel.SimpleChannelInboundHandler.channelRead (SimpleChannelInboundHandler.java:105)
~ [netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:292)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:278)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.handler.timeout.IdleStateHandler.channelRead (IdleStateHandler.java:266)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:292)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:278)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.ChannelInboundHandlerAdapter.channelRead (ChannelInboundHandlerAdapter.java:86)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
org.littleshoot.proxy.impl.ProxyConnection $ RequestReadMonitor.channelRead (ProxyConnection.java:715)
[littleproxy-1.1.0-beta-bmp-12.jar: нет] в
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:292)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:278)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead (ByteToMessageDecoder.java:277)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.handler.codec.ByteToMessageDecoder.channelRead (ByteToMessageDecoder.java:264)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:292)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:278)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] вio.netty.channel.ChannelInboundHandlerAdapter.channelRead (ChannelInboundHandlerAdapter.java:86)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
org.littleshoot.proxy.impl.ProxyConnection $ BytesReadMonitor.channelRead (ProxyConnection.java:692)
[littleproxy-1.1.0-beta-bmp-12.jar: нет] в
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:292)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:278)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.DefaultChannelPipeline.fireChannelRead (DefaultChannelPipeline.java:962)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.nio.AbstractNioByteChannel $ NioByteUnsafe.read (AbstractNioByteChannel.java:131)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.nio.NioEventLoop.processSelectedKey (NioEventLoop.java:528)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized (NioEventLoop.java:485)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.nio.NioEventLoop.processSelectedKeys (NioEventLoop.java:399)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.channel.nio.NioEventLoop.run (NioEventLoop.java:371)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
io.netty.util.concurrent.SingleThreadEventExecutor $ 2.run (SingleThreadEventExecutor.java:112)
[netty-all-4.0.36.Final.jar: 4.0.36.Final] в
java.lang.Thread.run (Thread.java:745) [na: 1.8.0_101] 26 апреля 2018
11:45:23 org.openqa.selenium.remote.ProtocolHandshake createSession
ИНФОРМАЦИЯ: Обнаруженный диалект: OSS