예제 #1
0
    @Override
    public WipBrowserTab attach(TabDebugEventListener listener) throws IOException {
      LoggerFactory connectionLoggerFactory = browserImpl.getConnectionLoggerFactory();
      ConnectionLogger connectionLogger;
      if (connectionLoggerFactory == null) {
        connectionLogger = null;
      } else {
        connectionLogger = connectionLoggerFactory.newTabConnectionLogger();
      }
      String webSocketDebuggerUrl = description.webSocketDebuggerUrl();

      if (webSocketDebuggerUrl == null) {
        throw new IOException("Tab is already attached");
      }

      URI uri = URI.create(webSocketDebuggerUrl);
      WsConnection socket;
      if (USE_OLD_WEBSOCKET) {
        socket =
            Hybi00WsConnection.connect(
                browserImpl.getSocketAddress(),
                DEFAULT_CONNECTION_TIMEOUT_MS,
                uri.getPath(),
                "empty origin",
                connectionLogger);
      } else {
        socket =
            Hybi17WsConnection.connect(
                browserImpl.getSocketAddress(),
                DEFAULT_CONNECTION_TIMEOUT_MS,
                uri.getPath(),
                Hybi17WsConnection.MaskStrategy.TRANSPARENT_MASK,
                connectionLogger);
      }

      return new WipTabImpl(socket, browserImpl, listener, description.url());
    }
예제 #2
0
 @Override
 public String getUrl() {
   return description.url();
 }