Skip to content

onWebsocketHandshakeReceivedAsServer throwing InvalidDataException has no effect #530

@devgianlu

Description

@devgianlu

I've implemented this piece of code on my WebSocketServer:

public ServerHandshakeBuilder onWebsocketHandshakeReceivedAsServer(WebSocket conn, Draft draft, ClientHandshake request) throws InvalidDataException {
        ServerHandshakeBuilder builder = super.onWebsocketHandshakeReceivedAsServer(conn, draft, request);
        if (!shouldAccept(request)) {
            throw new InvalidDataException(CloseFrame.POLICY_VALIDATION, "Not accepted!");
        }

        return builder;
    }

When an invalid handshake is sent by the client, nothing happens. The client doesn't close the connection nor connect.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions