@Override
public void onClose(org.glassfish.grizzly.websockets.WebSocket gWebSocket, DataFrame dataFrame) {
try {
if (ahcListener instanceof WebSocketCloseCodeReasonListener) {
ClosingFrame cf = ClosingFrame.class.cast(dataFrame);
WebSocketCloseCodeReasonListener.class.cast(ahcListener).onClose(webSocket, cf.getCode(), cf.getReason());
} else {
ahcListener.onClose(webSocket);
}
} catch (Throwable e) {
ahcListener.onError(e);