class WebSocketImpl extends WebSocketTimeoutBase {
    private final WebSocketRequestImpl request;
    private final WebSocketResponse real;
    public WebSocketImpl(WebSocketRequest request) {
        this.request = ((WebSocketRequestImpl) request);
        this.real = this.request.getResponse();
        this.init(buildUri(request));
    }

    public URI buildUri(WebSocketRequest req) {<FILL_FUNCTION_BODY>}

    @Override
    public boolean isValid() {
        return isClosed() == false;
    }

    @Override
    public boolean isSecure() {
        return request.isSecure();
    }

    @Override
    public InetSocketAddress remoteAddress() {
        return request.getRemoteAddress();
    }

    @Override
    public InetSocketAddress localAddress() {
        return request.getLocalAddress();
    }

    @Override
    public void send(String text) {
        real.sendTextMessage(text);
        real.flush();

        onSend();
    }

    @Override
    public void send(ByteBuffer binary) {
        real.sendBinaryMessage(binary.array());
        real.flush();

        onSend();
    }

    @Override
    public void close() {
        super.close();
        real.close();
    }
}

        if (Utils.isEmpty(req.getQueryString())) {
            return URI.create(req.getRequestURL());
        } else {
            if (req.getRequestURL().contains("?")) {
                return URI.create(req.getRequestURL());
            } else {
                return URI.create(req.getRequestURL() + "?" + req.getQueryString());
            }
        }
    
<methods>public non-sealed void <init>() ,public long getIdleTimeout() ,public void onReceive() ,public void onSend() ,public void setIdleTimeout(long) <variables>private final java.util.concurrent.locks.ReentrantLock SYNC_LOCK,private long idleTimeout,private ScheduledFuture<?> idleTimeoutFuture,private long liveTime