Source:
<code>public ClientServerInputMultiplexer( DuplexConnection source, PluginRegistry plugins, boolean isClient) { this.source = source; final MonoProcessor<Flux<ByteBuf>> setup = MonoProcessor.create(); final MonoProcessor<Flux<ByteBuf>> server = MonoProcessor.create(); final MonoProcessor<Flux<ByteBuf>> client = MonoProcessor.create(); source = plugins.applyConnection(Type.SOURCE, source); setupConnection = plugins.applyConnection(Type.SETUP, new InternalDuplexConnection(source, setup)); serverConnection = plugins.applyConnection(Type.SERVER, new InternalDuplexConnection(source, server)); clientConnection = plugins.applyConnection(Type.CLIENT, new InternalDuplexConnection(source, client)); clientServerConnection = new InternalDuplexConnection(source, client, server); source .receive() .groupBy( frame -> { int streamId = FrameHeaderFlyweight.streamId(frame); final Type type; if (streamId == 0) { FrameType frameType = FrameHeaderFlyweight.frameType(frame); <START> if (isSetup(frameType)) { <END> type = Type.SETUP; } else { if (isRequesterFrame(frameType)) { type = isClient ? Type.CLIENT : Type.SERVER; } else { type = isClient ? Type.SERVER : Type.CLIENT; } } } else if ((streamId & 0b1) == 0) { type = Type.SERVER; } else { type = Type.CLIENT; } return type; }) .subscribe( group -> { switch (group.key()) { case SETUP: setup.onNext(group); break; case SERVER: server.onNext(group); break; case CLIENT: client.onNext(group); break; } }, t -> { LOGGER.error("Error receiving frame:", t); dispose(); }); }</code><technical_language>instead of isSetup isRequestFrame methods, if/elses replace switch statement? extra if/else if switch statement</technical_language>

Target:
public ClientServerInputMultiplexer( DuplexConnection source, PluginRegistry plugins, boolean isClient) { this.source = source; final MonoProcessor<Flux<ByteBuf>> setup = MonoProcessor.create(); final MonoProcessor<Flux<ByteBuf>> server = MonoProcessor.create(); final MonoProcessor<Flux<ByteBuf>> client = MonoProcessor.create(); source = plugins.applyConnection(Type.SOURCE, source); setupConnection = plugins.applyConnection(Type.SETUP, new InternalDuplexConnection(source, setup)); serverConnection = plugins.applyConnection(Type.SERVER, new InternalDuplexConnection(source, server)); clientConnection = plugins.applyConnection(Type.CLIENT, new InternalDuplexConnection(source, client)); clientServerConnection = new InternalDuplexConnection(source, client, server); source .receive() .groupBy( frame -> { int streamId = FrameHeaderFlyweight.streamId(frame); final Type type; if (streamId == 0) { switch (FrameHeaderFlyweight.frameType(frame)) { case SETUP: case RESUME: case RESUME_OK: type = Type.SETUP; break; case LEASE: case KEEPALIVE: case ERROR: type = isClient ? Type.CLIENT : Type.SERVER; break; default: type = isClient ? Type.SERVER : Type.CLIENT; } } else if ((streamId & 0b1) == 0) { type = Type.SERVER; } else { type = Type.CLIENT; } return type; }) .subscribe( group -> { switch (group.key()) { case SETUP: setup.onNext(group); break; case SERVER: server.onNext(group); break; case CLIENT: client.onNext(group); break; } }, t -> { LOGGER.error("Error receiving frame:", t); dispose(); }); }