Skip to content

Setting up WebSocket protocol #408

Closed
@snezhana-dorogova

Description

@snezhana-dorogova

Hi,
when I use browsermob-proxy all connections goes through https:// even WebSocket methods.
For example: GET /echo HTTP/1.1 returns WebSocket-Location: wss://site.com/echo/123/websocket, after that initiates GET wss://site.com/echo/123/websocket with response code 101 switching protocols. But with browsermob-proxy initiates request GET https://site.com/echo/123/websocket

I've try to change protocol with addRequestFilter() but there is only http version of protocol:

proxy.addRequestFilter(new RequestFilter() {
   @Override
    public HttpResponse filterRequest(HttpRequest request, HttpMessageContents contents,    HttpMessageInfo messageInfo) {
       if (request.getUri().contains("echo/") && request.getUri().contains("/websocket")) {
           request.setProtocolVersion(new HttpVersion("WSS/1.1", true));
       }
       return null;
   }
});

There is no info about WebSocket and browsermob-proxy just this self-reply https://groups.google.com/forum/#!topic/browsermob-proxy/JzTHxje0qP4

I need proxy to monitor HTTP and WebSocket, there are a lot of autotests that I could make with it, but if I run tests with WebSocket it does not work at all.

Kind regards!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions