@Test public void shouldRemoveExtensionFilters() throws Exception { final IoFilterChain filterChain = shouldAddExtensionFiltersAfterCodec_withResult(); context.checking(new Expectations() { { oneOf(extension1).getFilter(); will(returnValue((null))); oneOf(extension2).getFilter(); will(returnValue((extensionFilter2))); oneOf(extension1).getExtensionHeader(); will(returnValue(extensionHeader1)); oneOf(extensionHeader1).getExtensionToken(); will(returnValue(("extension1"))); oneOf(extension2).getExtensionHeader(); will(returnValue(extensionHeader2)); oneOf(extensionHeader2).getExtensionToken(); will(returnValue(("extension2"))); oneOf(extension3).getFilter(); will(returnValue((extensionFilter3))); oneOf(extension3).getExtensionHeader(); will(returnValue(extensionHeader3)); oneOf(extensionHeader3).getExtensionToken(); will(returnValue(("extension3"))); oneOf(extensionFilter2).onPreRemove(with(filterChain), with(any(String.class)), with(any(NextFilter.class))); oneOf(extensionFilter2).onPostRemove(with(filterChain), with(any(String.class)), with(any(NextFilter.class))); oneOf(extensionFilter3).onPreRemove(with(filterChain), with(any(String.class)), with(any(NextFilter.class))); oneOf(extensionFilter3).onPostRemove(with(filterChain), with(any(String.class)), with(any(NextFilter.class))); } }); WsUtils.removeExtensionFilters(extensions, filterChain); }
public static void removeExtensionFilters(List<WebSocketExtension> extensions, IoFilterChain filterChain) { for (WebSocketExtension extension: extensions) { Entry entry = filterChain.getEntry(extension.getExtensionHeader().getExtensionToken()); if (entry != null) { entry.remove(); } } }
WsUtils { public static void removeExtensionFilters(List<WebSocketExtension> extensions, IoFilterChain filterChain) { for (WebSocketExtension extension: extensions) { Entry entry = filterChain.getEntry(extension.getExtensionHeader().getExtensionToken()); if (entry != null) { entry.remove(); } } } }
WsUtils { public static void removeExtensionFilters(List<WebSocketExtension> extensions, IoFilterChain filterChain) { for (WebSocketExtension extension: extensions) { Entry entry = filterChain.getEntry(extension.getExtensionHeader().getExtensionToken()); if (entry != null) { entry.remove(); } } } private  WsUtils(); }
WsUtils { public static void removeExtensionFilters(List<WebSocketExtension> extensions, IoFilterChain filterChain) { for (WebSocketExtension extension: extensions) { Entry entry = filterChain.getEntry(extension.getExtensionHeader().getExtensionToken()); if (entry != null) { entry.remove(); } } } private  WsUtils(); static void addExtensionFilters(List<WebSocketExtension> extensions,
                                           ExtensionHelper helper,
                                           IoFilterChain filterChain,
                                           boolean hasCodec); static ByteBuffer computeHash(CharSequence key1, CharSequence key2, ByteBuffer key3); static String acceptHash(String key); static int calculateEncodedLengthSize(int lengthValue); static void encodeLength(ByteBuffer buf, int lengthValue); static void handleExtensionNegotiationException(HttpAcceptSession session, List<String> clientRequestedExtensions,
                                                            ProtocolException e, Logger logger); static WebSocketWireProtocol guessWireProtocolVersion(HttpRequestMessage httpRequest); static List<WebSocketExtension> negotiateExtensionsAndSetResponseHeader(
                                                        WebSocketExtensionFactory factory,
                                                        WsResourceAddress address,
                                                        List<String> requestedExtensions,
                                                        HttpAcceptSession session,
                                                        String extendionsHeaderName, ExtensionHelper extensionHelper); static String negotiateWebSocketProtocol(HttpAcceptSession session, String protocolHeaderName,
                                                    List<String> clientRequestedWsProtocols,
                                                    List<String> serverWsProtocols); static void removeExtensionFilters(List<WebSocketExtension> extensions, IoFilterChain filterChain); static String secWebSocketKey(); }
WsUtils { public static void removeExtensionFilters(List<WebSocketExtension> extensions, IoFilterChain filterChain) { for (WebSocketExtension extension: extensions) { Entry entry = filterChain.getEntry(extension.getExtensionHeader().getExtensionToken()); if (entry != null) { entry.remove(); } } } private  WsUtils(); static void addExtensionFilters(List<WebSocketExtension> extensions,
                                           ExtensionHelper helper,
                                           IoFilterChain filterChain,
                                           boolean hasCodec); static ByteBuffer computeHash(CharSequence key1, CharSequence key2, ByteBuffer key3); static String acceptHash(String key); static int calculateEncodedLengthSize(int lengthValue); static void encodeLength(ByteBuffer buf, int lengthValue); static void handleExtensionNegotiationException(HttpAcceptSession session, List<String> clientRequestedExtensions,
                                                            ProtocolException e, Logger logger); static WebSocketWireProtocol guessWireProtocolVersion(HttpRequestMessage httpRequest); static List<WebSocketExtension> negotiateExtensionsAndSetResponseHeader(
                                                        WebSocketExtensionFactory factory,
                                                        WsResourceAddress address,
                                                        List<String> requestedExtensions,
                                                        HttpAcceptSession session,
                                                        String extendionsHeaderName, ExtensionHelper extensionHelper); static String negotiateWebSocketProtocol(HttpAcceptSession session, String protocolHeaderName,
                                                    List<String> clientRequestedWsProtocols,
                                                    List<String> serverWsProtocols); static void removeExtensionFilters(List<WebSocketExtension> extensions, IoFilterChain filterChain); static String secWebSocketKey(); static final String SEC_WEB_SOCKET_VERSION; static final String SEC_WEB_SOCKET_KEY; static final String SEC_WEB_SOCKET_KEY1; static final String SEC_WEB_SOCKET_KEY2; static final String HEADER_X_WEBSOCKET_EXTENSIONS; static final String HEADER_WEBSOCKET_EXTENSIONS; static final String HEADER_SEC_WEBSOCKET_EXTENSIONS; static final TypedAttributeKey<List<WebSocketExtension>> ACTIVE_EXTENSIONS_KEY; }