From 2c136983856de7d61c9166c64baaed0de05a1c29 Mon Sep 17 00:00:00 2001 From: "http4s-steward[bot]" <106843772+http4s-steward[bot]@users.noreply.github.com> Date: Tue, 1 Nov 2022 02:36:51 +0000 Subject: [PATCH 1/4] Update scalafmt-core to 3.6.1 in series/0.23 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 299ac8073..2fe5bb6e6 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.6.0 +version = 3.6.1 style = default From 7c66b82deb1c0c64e8b3360c34cd52145ceaeab5 Mon Sep 17 00:00:00 2001 From: "http4s-steward[bot]" <106843772+http4s-steward[bot]@users.noreply.github.com> Date: Tue, 1 Nov 2022 02:37:05 +0000 Subject: [PATCH 2/4] Reformat with scalafmt 3.6.1 Executed command: scalafmt --non-interactive --- .../http4s/blaze/channel/ChannelHead.scala | 2 +- .../channel/nio1/FixedSelectorPool.scala | 2 +- .../channel/nio1/NIO1ClientChannel.scala | 2 +- .../blaze/channel/nio1/NIO1HeadStage.scala | 4 +- .../channel/nio1/NIO1SocketServerGroup.scala | 20 ++-- .../blaze/channel/nio1/SelectorLoop.scala | 4 +- .../blaze/channel/nio2/ByteBufferHead.scala | 4 +- .../channel/nio2/ClientChannelFactory.scala | 6 +- .../blaze/pipeline/PipelineBuilder.scala | 2 +- .../blaze/pipeline/stages/SSLStage.scala | 2 +- .../monitors/IntervalConnectionMonitor.scala | 8 +- .../scala/org/http4s/blaze/util/Actor.scala | 2 +- .../org/http4s/blaze/util/BufferTools.scala | 6 +- .../http4s/blaze/util/TickWheelExecutor.scala | 2 +- .../blaze/channel/ChannelOptionsSuite.scala | 6 +- .../blaze/pipeline/stages/DelayHead.scala | 4 +- .../blaze/pipeline/stages/SSLStageSuite.scala | 7 +- .../org/http4s/blaze/util/ActorSuite.scala | 5 +- .../http4s/blaze/util/BufferToolsSuite.scala | 6 +- .../http4s/blaze/util/TaskQueueSuite.scala | 2 +- .../blaze/util/TickWheelExecutorSuite.scala | 4 +- .../com/example/http4s/ExampleService.scala | 2 +- .../com/example/http4s/HeaderExamples.scala | 6 +- .../blaze/ClientMultipartPostExample.scala | 4 +- .../blaze/demo/client/MultipartClient.scala | 2 +- .../http4s/blaze/demo/server/Server.scala | 2 +- .../main/scala/com/example/http4s/ssl.scala | 4 +- .../org/http4s/blaze/http/HttpRequest.scala | 2 +- .../blaze/http/http2/ConnectionImpl.scala | 8 +- .../http/http2/DefaultFlowStrategy.scala | 4 +- .../blaze/http/http2/FrameDecoder.scala | 6 +- .../blaze/http/http2/FrameEncoder.scala | 6 +- .../blaze/http/http2/FrameListener.scala | 4 +- .../blaze/http/http2/FrameSerializer.scala | 14 +-- .../HeaderAggregatingFrameListener.scala | 12 +- .../blaze/http/http2/HeaderDecoder.scala | 4 +- .../blaze/http/http2/Http2Settings.scala | 10 +- .../http/http2/InboundStreamStateImpl.scala | 2 +- .../http4s/blaze/http/http2/PingManager.scala | 6 +- .../http/http2/SessionFlowControlImpl.scala | 2 +- .../http/http2/SessionFrameListener.scala | 6 +- .../blaze/http/http2/SettingsDecoder.scala | 2 +- .../blaze/http/http2/StreamIdManager.scala | 2 +- .../blaze/http/http2/StreamManagerImpl.scala | 2 +- .../blaze/http/http2/StreamStateImpl.scala | 4 +- .../http/http2/WriteControllerImpl.scala | 4 +- .../http2/server/ALPNServerSelector.scala | 2 +- .../ServerPriorKnowledgeHandshaker.scala | 8 +- .../http4s/blaze/http/util/HeaderTools.scala | 4 +- .../http4s/blaze/http/BodyReaderSuite.scala | 2 +- .../http/http2/ConnectionImplSuite.scala | 2 +- .../blaze/http/http2/FrameDecoderSuite.scala | 104 +++++++++--------- .../blaze/http/http2/FrameEncoderSuite.scala | 10 +- .../http/http2/FrameSerializerSuite.scala | 24 ++-- .../HeaderAggregatingFrameListenerSuite.scala | 8 +- .../blaze/http/http2/HeaderDecoderSuite.scala | 4 +- .../blaze/http/http2/HeaderEncoderSuite.scala | 2 +- .../http/http2/ProtocolFrameDecoder.scala | 2 +- .../ServerPriorKnowledgeHandshakerSuite.scala | 2 +- .../http/http2/SessionFlowControlSuite.scala | 4 +- .../http2/SessionFrameListenerSuite.scala | 12 +- .../http/http2/StreamFlowWindowSuite.scala | 4 +- .../http/http2/StreamStateImplSuite.scala | 10 +- .../http/http2/mocks/MockFrameListener.scala | 6 +- .../MockHeaderAggregatingFrameListener.scala | 8 +- .../mocks/ObservingSessionFlowControl.scala | 2 +- .../blaze/http/parser/BenchParser.scala | 2 +- .../blaze/http/parser/ClientParserSuite.scala | 2 +- .../blaze/http/parser/ResponseParser.scala | 2 +- .../blaze/http/parser/ServerParserSuite.scala | 4 +- 70 files changed, 228 insertions(+), 222 deletions(-) diff --git a/core/src/main/scala/org/http4s/blaze/channel/ChannelHead.scala b/core/src/main/scala/org/http4s/blaze/channel/ChannelHead.scala index 70fb566f8..25f4a5323 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/ChannelHead.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/ChannelHead.scala @@ -47,6 +47,6 @@ object ChannelHead { "Connection reset", // Found on Linux, Java 13 "An existing connection was forcibly closed by the remote host", // Found on Windows "Broken pipe", // also found on Linux - "The specified network name is no longer available.\r\n" // Found on Windows NIO2 + "The specified network name is no longer available.\r\n", // Found on Windows NIO2 ) } diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala index c04f68abd..635877f5c 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala @@ -26,7 +26,7 @@ import scala.annotation.tailrec final class FixedSelectorPool( poolSize: Int, bufferSize: Int, - threadFactory: ThreadFactory + threadFactory: ThreadFactory, ) extends SelectorLoopPool { require(poolSize > 0, s"Invalid pool size: $poolSize") diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1ClientChannel.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1ClientChannel.scala index 262baf5dc..96f032a67 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1ClientChannel.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1ClientChannel.scala @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean private[blaze] final class NIO1ClientChannel( private[this] val underlying: SocketChannel, - private[this] val onClose: () => Unit + private[this] val onClose: () => Unit, ) extends NIO1Channel { private[this] val closed = new AtomicBoolean(false) diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1HeadStage.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1HeadStage.scala index 87d042bc1..e2d692e4d 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1HeadStage.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1HeadStage.scala @@ -72,7 +72,7 @@ private[nio1] object NIO1HeadStage { private def performWrite( ch: NIO1ClientChannel, scratch: ByteBuffer, - buffers: Array[ByteBuffer] + buffers: Array[ByteBuffer], ): WriteResult = try if (BufferTools.areDirectOrEmpty(buffers)) { @@ -122,7 +122,7 @@ private[nio1] object NIO1HeadStage { private[nio1] final class NIO1HeadStage( ch: NIO1ClientChannel, selectorLoop: SelectorLoop, - key: SelectionKey + key: SelectionKey, ) extends ChannelHead with Selectable { import NIO1HeadStage._ diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1SocketServerGroup.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1SocketServerGroup.scala index 8978b6904..b057d5a63 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1SocketServerGroup.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1SocketServerGroup.scala @@ -28,7 +28,7 @@ import org.http4s.blaze.channel.{ DefaultPoolSize, ServerChannel, ServerChannelGroup, - SocketPipelineBuilder + SocketPipelineBuilder, } import org.http4s.blaze.pipeline.Command import org.http4s.blaze.util.{BasicThreadFactory, Connections} @@ -67,7 +67,7 @@ object NIO1SocketServerGroup { acceptorPool: SelectorLoopPool, workerPool: SelectorLoopPool, channelOptions: ChannelOptions = ChannelOptions.DefaultOptions, - maxConnections: Int = DefaultMaxConnections + maxConnections: Int = DefaultMaxConnections, ): ServerChannelGroup = new NIO1SocketServerGroup(acceptorPool, workerPool, channelOptions, maxConnections) @@ -82,7 +82,7 @@ object NIO1SocketServerGroup { selectorThreadFactory: ThreadFactory = defaultWorkerThreadFactory, acceptorThreads: Int = 1, acceptorThreadFactory: ThreadFactory = defaultAcceptorThreadFactory, - maxConnections: Int = DefaultMaxConnections + maxConnections: Int = DefaultMaxConnections, ): ServerChannelGroup = { val acceptorPool = new FixedSelectorPool(acceptorThreads, 1, acceptorThreadFactory) val workerPool = new FixedSelectorPool(workerThreads, bufferSize, selectorThreadFactory) @@ -104,7 +104,7 @@ object NIO1SocketServerGroup { override def bind( address: InetSocketAddress, - service: SocketPipelineBuilder + service: SocketPipelineBuilder, ): Try[ServerChannel] = underlying.bind(address, service) } @@ -122,7 +122,7 @@ private final class NIO1SocketServerGroup private ( acceptorPool: SelectorLoopPool, workerPool: SelectorLoopPool, channelOptions: ChannelOptions, - maxConnections: Int + maxConnections: Int, ) extends ServerChannelGroup { private[this] val logger = getLogger // Also acts as our intrinsic lock. @@ -140,7 +140,7 @@ private final class NIO1SocketServerGroup private ( private[this] class SocketAcceptor( key: SelectionKey, ch: ServerChannelImpl, - service: SocketPipelineBuilder + service: SocketPipelineBuilder, ) extends Selectable { // Save it since once the channel is closed, we're in trouble. private[this] val closed = new AtomicBoolean(false) @@ -192,7 +192,7 @@ private final class NIO1SocketServerGroup private ( // minimize race conditions. private[this] final class ServerChannelImpl( val selectableChannel: ServerSocketChannel, - selectorLoop: SelectorLoop + selectorLoop: SelectorLoop, ) extends ServerChannel with NIO1Channel { @volatile @@ -252,7 +252,7 @@ private final class NIO1SocketServerGroup private ( */ override def bind( address: InetSocketAddress, - service: SocketPipelineBuilder + service: SocketPipelineBuilder, ): Try[ServerChannel] = Try { val ch = ServerSocketChannel.open().bind(address) @@ -283,7 +283,7 @@ private final class NIO1SocketServerGroup private ( // Will be called from within the SelectorLoop private[this] def buildSocketAcceptor( ch: ServerChannelImpl, - service: SocketPipelineBuilder + service: SocketPipelineBuilder, )(key: SelectionKey): Selectable = { val acceptor = new SocketAcceptor(key, ch, service) try key.interestOps(SelectionKey.OP_ACCEPT) @@ -295,7 +295,7 @@ private final class NIO1SocketServerGroup private ( private[this] def handleClientChannel( clientChannel: NIO1ClientChannel, - service: SocketPipelineBuilder + service: SocketPipelineBuilder, ): Unit = try { clientChannel.configureBlocking(false) diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/SelectorLoop.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/SelectorLoop.scala index 64227e3bb..2876f3716 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/SelectorLoop.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/SelectorLoop.scala @@ -47,7 +47,7 @@ import scala.util.control.{ControlThrowable, NonFatal} final class SelectorLoop( selector: Selector, bufferSize: Int, - threadFactory: ThreadFactory + threadFactory: ThreadFactory, ) extends Executor with ExecutionContext { require(bufferSize > 0, s"Invalid buffer size: $bufferSize") @@ -126,7 +126,7 @@ final class SelectorLoop( */ def initChannel( ch: NIO1Channel, - mkStage: SelectionKey => Selectable + mkStage: SelectionKey => Selectable, ): Unit = enqueueTask(new Runnable { override def run(): Unit = diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio2/ByteBufferHead.scala b/core/src/main/scala/org/http4s/blaze/channel/nio2/ByteBufferHead.scala index ee5a46397..5bee5c785 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio2/ByteBufferHead.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio2/ByteBufferHead.scala @@ -68,7 +68,7 @@ private[nio2] final class ByteBufferHead(channel: AsynchronousSocketChannel, buf p.success(()) () } - } + }, ) go(0) @@ -107,7 +107,7 @@ private[nio2] final class ByteBufferHead(channel: AsynchronousSocketChannel, buf p.success(BufferTools.copyBuffer(scratchBuffer)) () } - } + }, ) p.future } diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio2/ClientChannelFactory.scala b/core/src/main/scala/org/http4s/blaze/channel/nio2/ClientChannelFactory.scala index e10acbfc2..05b6cbd0f 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio2/ClientChannelFactory.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio2/ClientChannelFactory.scala @@ -44,7 +44,7 @@ final class ClientChannelFactory( group: Option[AsynchronousChannelGroup] = None, channelOptions: ChannelOptions = ChannelOptions.DefaultOptions, scheduler: TickWheelExecutor = Execution.scheduler, - connectTimeout: Duration = Duration.Inf + connectTimeout: Duration = Duration.Inf, ) { private[this] val logger = getLogger @@ -52,13 +52,13 @@ final class ClientChannelFactory( def this( bufferSize: Int, group: Option[AsynchronousChannelGroup], - channelOptions: ChannelOptions + channelOptions: ChannelOptions, ) = this(bufferSize, group, channelOptions, Execution.scheduler, Duration.Inf) def connect( remoteAddress: SocketAddress, - bufferSize: Int = bufferSize + bufferSize: Int = bufferSize, ): Future[HeadStage[ByteBuffer]] = { val p = Promise[HeadStage[ByteBuffer]]() diff --git a/core/src/main/scala/org/http4s/blaze/pipeline/PipelineBuilder.scala b/core/src/main/scala/org/http4s/blaze/pipeline/PipelineBuilder.scala index abe9138a8..354ff8f8f 100644 --- a/core/src/main/scala/org/http4s/blaze/pipeline/PipelineBuilder.scala +++ b/core/src/main/scala/org/http4s/blaze/pipeline/PipelineBuilder.scala @@ -56,7 +56,7 @@ object LeafBuilder { */ final class TrunkBuilder[I1, O] private[pipeline] ( protected val head: MidStage[I1, _], - protected val tail: MidStage[_, O] + protected val tail: MidStage[_, O], ) { def append[N](stage: MidStage[O, N]): TrunkBuilder[I1, N] = { if (stage._prevStage != null) sys.error(s"Stage $stage must be fresh") diff --git a/core/src/main/scala/org/http4s/blaze/pipeline/stages/SSLStage.scala b/core/src/main/scala/org/http4s/blaze/pipeline/stages/SSLStage.scala index 1acf851b6..06427cbd4 100644 --- a/core/src/main/scala/org/http4s/blaze/pipeline/stages/SSLStage.scala +++ b/core/src/main/scala/org/http4s/blaze/pipeline/stages/SSLStage.scala @@ -32,7 +32,7 @@ import org.http4s.blaze.util.{ BufferTools, Execution, SerialExecutionContext, - ThreadLocalScratchBuffer + ThreadLocalScratchBuffer, } import org.http4s.blaze.util.BufferTools._ diff --git a/core/src/main/scala/org/http4s/blaze/pipeline/stages/monitors/IntervalConnectionMonitor.scala b/core/src/main/scala/org/http4s/blaze/pipeline/stages/monitors/IntervalConnectionMonitor.scala index a7b2052d2..889c4e2c3 100644 --- a/core/src/main/scala/org/http4s/blaze/pipeline/stages/monitors/IntervalConnectionMonitor.scala +++ b/core/src/main/scala/org/http4s/blaze/pipeline/stages/monitors/IntervalConnectionMonitor.scala @@ -21,7 +21,7 @@ import scala.concurrent.duration.Duration class IntervalConnectionMonitor(val interval: Duration) extends ConnectionMonitor { require( interval.isFinite && interval.toNanos > 1, - "Duration must be Finite and greater than 1 ns" + "Duration must be Finite and greater than 1 ns", ) private val alpha = 1.0 / (interval.toNanos + 1).toDouble @@ -75,7 +75,7 @@ class IntervalConnectionMonitor(val interval: Duration) extends ConnectionMonito ototal: Long, connmean: Double, conntotal: Long, - connlive: Long + connlive: Long, ) { override def toString: String = { val mb = (1024 * 1024).toDouble @@ -101,7 +101,7 @@ class IntervalConnectionMonitor(val interval: Duration) extends ConnectionMonito ototal / f2, connmean, conntotal, - connlive + connlive, ) } } @@ -115,7 +115,7 @@ class IntervalConnectionMonitor(val interval: Duration) extends ConnectionMonito outbound.getTotal(), conns.getMean(), conns.getTotal(), - conns.getLive() + conns.getLive(), ) })) diff --git a/core/src/main/scala/org/http4s/blaze/util/Actor.scala b/core/src/main/scala/org/http4s/blaze/util/Actor.scala index 50eec94bf..01a174de4 100644 --- a/core/src/main/scala/org/http4s/blaze/util/Actor.scala +++ b/core/src/main/scala/org/http4s/blaze/util/Actor.scala @@ -29,7 +29,7 @@ import org.http4s.blaze.util.Actor.DefaultMaxIterations */ private[blaze] abstract class Actor[M]( ec: ExecutionContext, - maxTasksBeforeReschedule: Int = DefaultMaxIterations + maxTasksBeforeReschedule: Int = DefaultMaxIterations, ) { require(maxTasksBeforeReschedule > 0) diff --git a/core/src/main/scala/org/http4s/blaze/util/BufferTools.scala b/core/src/main/scala/org/http4s/blaze/util/BufferTools.scala index 7a0dc3f9d..2f078978e 100644 --- a/core/src/main/scala/org/http4s/blaze/util/BufferTools.scala +++ b/core/src/main/scala/org/http4s/blaze/util/BufferTools.scala @@ -78,8 +78,10 @@ object BufferTools { oldbuff // already established that oldbuff is not `null` else if (!oldbuff.hasRemaining) newbuff else if (!newbuff.hasRemaining) oldbuff - else if (!oldbuff.isReadOnly && oldbuff - .capacity() >= oldbuff.limit() + newbuff.remaining()) { + else if ( + !oldbuff.isReadOnly && oldbuff + .capacity() >= oldbuff.limit() + newbuff.remaining() + ) { // Enough room to append newbuff to the end tof oldbuff oldbuff .mark() diff --git a/core/src/main/scala/org/http4s/blaze/util/TickWheelExecutor.scala b/core/src/main/scala/org/http4s/blaze/util/TickWheelExecutor.scala index 55c1fc649..8fe135e9f 100644 --- a/core/src/main/scala/org/http4s/blaze/util/TickWheelExecutor.scala +++ b/core/src/main/scala/org/http4s/blaze/util/TickWheelExecutor.scala @@ -243,7 +243,7 @@ class TickWheelExecutor(wheelSize: Int = DefaultWheelSize, val tick: Duration = val expiration: Long, var prev: Node, var next: Node, - var canceled: Boolean = false + var canceled: Boolean = false, ) extends Cancelable { /** Remove this node from its linked list */ diff --git a/core/src/test/scala/org/http4s/blaze/channel/ChannelOptionsSuite.scala b/core/src/test/scala/org/http4s/blaze/channel/ChannelOptionsSuite.scala index f8e0dd840..666213f38 100644 --- a/core/src/test/scala/org/http4s/blaze/channel/ChannelOptionsSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/channel/ChannelOptionsSuite.scala @@ -26,7 +26,7 @@ class ChannelOptionsSuite extends FunSuite { test("A ChannelOptions should be set on a NetworkChannel") { val options = ChannelOptions( OptionValue[java.lang.Boolean](java.net.StandardSocketOptions.TCP_NODELAY, true), - OptionValue[java.lang.Boolean](java.net.StandardSocketOptions.SO_KEEPALIVE, false) + OptionValue[java.lang.Boolean](java.net.StandardSocketOptions.SO_KEEPALIVE, false), ) val ch = new NetworkChannel { @@ -62,11 +62,11 @@ class ChannelOptionsSuite extends FunSuite { assertEquals( ch.getOption[java.lang.Boolean](java.net.StandardSocketOptions.TCP_NODELAY), - java.lang.Boolean.TRUE + java.lang.Boolean.TRUE, ) assertEquals( ch.getOption[java.lang.Boolean](java.net.StandardSocketOptions.SO_KEEPALIVE), - java.lang.Boolean.FALSE + java.lang.Boolean.FALSE, ) } } diff --git a/core/src/test/scala/org/http4s/blaze/pipeline/stages/DelayHead.scala b/core/src/test/scala/org/http4s/blaze/pipeline/stages/DelayHead.scala index f42b87c63..277f38b3e 100644 --- a/core/src/test/scala/org/http4s/blaze/pipeline/stages/DelayHead.scala +++ b/core/src/test/scala/org/http4s/blaze/pipeline/stages/DelayHead.scala @@ -63,7 +63,7 @@ abstract class DelayHead[I](delay: Duration) extends HeadStage[I] { } }, delay.toNanos, - TimeUnit.NANOSECONDS + TimeUnit.NANOSECONDS, ) p.future } @@ -78,7 +78,7 @@ abstract class DelayHead[I](delay: Duration) extends HeadStage[I] { } }, delay.toNanos, - TimeUnit.NANOSECONDS + TimeUnit.NANOSECONDS, ) rememberPromise(p) diff --git a/core/src/test/scala/org/http4s/blaze/pipeline/stages/SSLStageSuite.scala b/core/src/test/scala/org/http4s/blaze/pipeline/stages/SSLStageSuite.scala index 732be0dc8..f4708029c 100644 --- a/core/src/test/scala/org/http4s/blaze/pipeline/stages/SSLStageSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/pipeline/stages/SSLStageSuite.scala @@ -42,7 +42,7 @@ class SSLStageSuite extends BlazeTestSuite { // The battery of tests for both client and server private def testBattery( testSuitePrefix: String, - mkClientServerEngines: => (SSLEngine, SSLEngine) + mkClientServerEngines: => (SSLEngine, SSLEngine), ) = { test(testSuitePrefix + " should transcode a single buffer") { val (headEng, stageEng) = mkClientServerEngines @@ -93,8 +93,9 @@ class SSLStageSuite extends BlazeTestSuite { r <- Future(BufferTools.mkString(head.results)) h <- Future(head.multipleWrite) } yield r -> h, - s + s -> false - )) + s + s -> false, + ) + ) } test(testSuitePrefix + " should transcode multiple single byte buffers") { diff --git a/core/src/test/scala/org/http4s/blaze/util/ActorSuite.scala b/core/src/test/scala/org/http4s/blaze/util/ActorSuite.scala index f0fea7d78..1b9c9b9d6 100644 --- a/core/src/test/scala/org/http4s/blaze/util/ActorSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/util/ActorSuite.scala @@ -57,13 +57,14 @@ class ActorSuite extends FunSuite { flag.set(t) latch.countDown() }, - global + global, ) for (_ <- 0 until senders) global.execute(() => for (_ <- 0 until messages) - a ! Continuation(_ => latch.countDown())) + a ! Continuation(_ => latch.countDown()) + ) assert(latch.await(15, TimeUnit.SECONDS)) diff --git a/core/src/test/scala/org/http4s/blaze/util/BufferToolsSuite.scala b/core/src/test/scala/org/http4s/blaze/util/BufferToolsSuite.scala index 6b2e8a6b7..41d9b78c8 100644 --- a/core/src/test/scala/org/http4s/blaze/util/BufferToolsSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/util/BufferToolsSuite.scala @@ -119,7 +119,7 @@ class BufferToolsSuite extends FunSuite { _ => fail( "BufferTools.takeSlice should throw an `IllegalArgumentException` if you try to slice too many bytes" - ) + ), ) } @@ -140,14 +140,14 @@ class BufferToolsSuite extends FunSuite { _ => fail( "BufferTools.takeSlice should throw an `IllegalArgumentException` if you try to slice negative bytes" - ) + ), ) } test("BufferTools.checkEmpty should check if buffers are empty") { assertEquals( BufferTools.checkEmpty(Array(ByteBuffer.allocate(0), ByteBuffer.allocate(3))), - false + false, ) assertEquals(BufferTools.checkEmpty(Seq(ByteBuffer.allocate(0), ByteBuffer.allocate(3))), false) diff --git a/core/src/test/scala/org/http4s/blaze/util/TaskQueueSuite.scala b/core/src/test/scala/org/http4s/blaze/util/TaskQueueSuite.scala index 93435959f..ce9fd1a56 100644 --- a/core/src/test/scala/org/http4s/blaze/util/TaskQueueSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/util/TaskQueueSuite.scala @@ -107,7 +107,7 @@ class TaskQueueSuite extends FunSuite { counter.incrementAndGet() () }, - TaskQueue.Enqueued + TaskQueue.Enqueued, ) sleepLatch.countDown() diff --git a/core/src/test/scala/org/http4s/blaze/util/TickWheelExecutorSuite.scala b/core/src/test/scala/org/http4s/blaze/util/TickWheelExecutorSuite.scala index fa2df8ca9..12d163f30 100644 --- a/core/src/test/scala/org/http4s/blaze/util/TickWheelExecutorSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/util/TickWheelExecutorSuite.scala @@ -118,7 +118,7 @@ class TickWheelExecutorSuite extends FunSuite { case _: RuntimeException => () case ex => fail(s"Unexpected exception found $ex") }, - _ => fail("A TickWheelExecutor should shutdown") + _ => fail("A TickWheelExecutor should shutdown"), ) val result2 = Try(ec.schedule(() => sys.error("Woops!"), Duration.Inf)) @@ -128,7 +128,7 @@ class TickWheelExecutorSuite extends FunSuite { case _: RuntimeException => () case ex => fail(s"Unexpected exception found $ex") }, - _ => fail("A TickWheelExecutor should shutdown") + _ => fail("A TickWheelExecutor should shutdown"), ) } } diff --git a/examples/src/main/scala/com/example/http4s/ExampleService.scala b/examples/src/main/scala/com/example/http4s/ExampleService.scala index e7476b6de..c9e3914d6 100644 --- a/examples/src/main/scala/com/example/http4s/ExampleService.scala +++ b/examples/src/main/scala/com/example/http4s/ExampleService.scala @@ -38,7 +38,7 @@ class ExampleService[F[_]](implicit F: Async[F]) extends Http4sDsl[F] { def routes: HttpRoutes[F] = Router[F]( "" -> rootRoutes, - "/auth" -> authRoutes + "/auth" -> authRoutes, ) def rootRoutes: HttpRoutes[F] = diff --git a/examples/src/main/scala/com/example/http4s/HeaderExamples.scala b/examples/src/main/scala/com/example/http4s/HeaderExamples.scala index 84b3b46a4..a937d1de4 100644 --- a/examples/src/main/scala/com/example/http4s/HeaderExamples.scala +++ b/examples/src/main/scala/com/example/http4s/HeaderExamples.scala @@ -40,7 +40,7 @@ object HeaderExamples { val myHeaders: Headers = Headers( Foo("hello"), "my" -> "header", - baz + baz, ) // //// test for selection final case class Bar(v: NonEmptyList[String]) @@ -73,7 +73,7 @@ object HeaderExamples { Foo("two"), SetCookie("cookie1", "a cookie"), Bar(NonEmptyList.one("three")), - SetCookie("cookie2", "another cookie") + SetCookie("cookie2", "another cookie"), ) val a: Option[Foo] = hs.get[Foo] @@ -98,7 +98,7 @@ object HeaderExamples { "a" -> "b", Option("a" -> "c"), List("a" -> "c"), - List(SetCookie("cookie3", "cookie three")) + List(SetCookie("cookie3", "cookie three")), // , // Option(List("a" -> "c")) // correctly fails to compile ) diff --git a/examples/src/main/scala/com/example/http4s/blaze/ClientMultipartPostExample.scala b/examples/src/main/scala/com/example/http4s/blaze/ClientMultipartPostExample.scala index 48d79c4b1..24eed849d 100644 --- a/examples/src/main/scala/com/example/http4s/blaze/ClientMultipartPostExample.scala +++ b/examples/src/main/scala/com/example/http4s/blaze/ClientMultipartPostExample.scala @@ -37,14 +37,14 @@ object ClientMultipartPostExample extends IOApp with Http4sClientDsl[IO] { val url = Uri( scheme = Some(Scheme.http), authority = Some(Authority(host = RegName("httpbin.org"))), - path = path"/post" + path = path"/post", ) multiparts .multipart( Vector( Part.formData("text", "This is text."), - Part.fileData("BALL", bottle, `Content-Type`(MediaType.image.png)) + Part.fileData("BALL", bottle, `Content-Type`(MediaType.image.png)), ) ) .flatMap { multipart => diff --git a/examples/src/main/scala/com/example/http4s/blaze/demo/client/MultipartClient.scala b/examples/src/main/scala/com/example/http4s/blaze/demo/client/MultipartClient.scala index 1d52f0474..5cb889287 100644 --- a/examples/src/main/scala/com/example/http4s/blaze/demo/client/MultipartClient.scala +++ b/examples/src/main/scala/com/example/http4s/blaze/demo/client/MultipartClient.scala @@ -45,7 +45,7 @@ class MultipartHttpClient(implicit S: StreamUtils[IO]) extends IOApp with Http4s body <- multiparts.multipart( Vector( Part.formData("name", "gvolpe"), - Part.fileData("rick", url, `Content-Type`(MediaType.image.png)) + Part.fileData("rick", url, `Content-Type`(MediaType.image.png)), ) ) } yield POST(body, uri"http://localhost:8080/v1/multipart").withHeaders(body.headers) diff --git a/examples/src/main/scala/com/example/http4s/blaze/demo/server/Server.scala b/examples/src/main/scala/com/example/http4s/blaze/demo/server/Server.scala index 5790991c4..76517ea3c 100644 --- a/examples/src/main/scala/com/example/http4s/blaze/demo/server/Server.scala +++ b/examples/src/main/scala/com/example/http4s/blaze/demo/server/Server.scala @@ -34,7 +34,7 @@ object HttpServer { s"/${endpoints.ApiVersion}/protected" -> ctx.basicAuthHttpEndpoint, s"/${endpoints.ApiVersion}" -> ctx.fileHttpEndpoint, s"/${endpoints.ApiVersion}/nonstream" -> ctx.nonStreamFileHttpEndpoint, - "/" -> ctx.httpServices + "/" -> ctx.httpServices, ).orNotFound def stream[F[_]: Async]: Stream[F, ExitCode] = diff --git a/examples/src/main/scala/com/example/http4s/ssl.scala b/examples/src/main/scala/com/example/http4s/ssl.scala index e195e2993..3d56a5a43 100644 --- a/examples/src/main/scala/com/example/http4s/ssl.scala +++ b/examples/src/main/scala/com/example/http4s/ssl.scala @@ -76,9 +76,9 @@ object ssl { Authority( userInfo = request.uri.authority.flatMap(_.userInfo), host = RegName(host), - port = securePort.some + port = securePort.some, ) - ) + ), ) MovedPermanently(Location(baseUri.withPath(request.uri.path))) case _ => diff --git a/http/src/main/scala/org/http4s/blaze/http/HttpRequest.scala b/http/src/main/scala/org/http4s/blaze/http/HttpRequest.scala index 834a5aff5..04961abfb 100644 --- a/http/src/main/scala/org/http4s/blaze/http/HttpRequest.scala +++ b/http/src/main/scala/org/http4s/blaze/http/HttpRequest.scala @@ -34,7 +34,7 @@ case class HttpRequest( majorVersion: Int, minorVersion: Int, headers: Headers, - body: BodyReader + body: BodyReader, ) { private[this] def formatStr(headersString: String): String = s"HttpRequest($method, $url, $majorVersion, $minorVersion, $headersString, $body)" diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/ConnectionImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/ConnectionImpl.scala index c1882a52d..8517e025e 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/ConnectionImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/ConnectionImpl.scala @@ -41,7 +41,7 @@ private final class ConnectionImpl( val remoteSettings: MutableHttp2Settings, flowStrategy: FlowStrategy, inboundStreamBuilder: Option[Int => LeafBuilder[StreamFrame]], - parentExecutor: ExecutionContext + parentExecutor: ExecutionContext, ) extends SessionCore with Connection { // Shortcut methods @@ -57,9 +57,9 @@ private final class ConnectionImpl( new HeaderDecoder( maxHeaderListSize = localSettings.maxHeaderListSize, discardOverflowHeaders = true, - maxTableSize = localSettings.headerTableSize - ) - ) + maxTableSize = localSettings.headerTableSize, + ), + ), ) @volatile diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/DefaultFlowStrategy.scala b/http/src/main/scala/org/http4s/blaze/http/http2/DefaultFlowStrategy.scala index a30954015..be5398dba 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/DefaultFlowStrategy.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/DefaultFlowStrategy.scala @@ -23,7 +23,7 @@ final class DefaultFlowStrategy(localSettings: Http2Settings) extends FlowStrate check( localSettings.initialWindowSize, session.sessionInboundWindow, - session.sessionUnconsumedBytes + session.sessionUnconsumedBytes, ) override def checkStream(stream: StreamFlowWindow): Increment = { @@ -31,7 +31,7 @@ final class DefaultFlowStrategy(localSettings: Http2Settings) extends FlowStrate val streamAck = check( localSettings.initialWindowSize, stream.streamInboundWindow, - stream.streamUnconsumedBytes + stream.streamUnconsumedBytes, ) FlowStrategy.increment(sessionAck, streamAck) diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala b/http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala index 46cd8a3c3..57c92cbba 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala @@ -174,7 +174,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener priority, Flags.END_HEADERS(flags), Flags.END_STREAM(flags), - buffer.slice() + buffer.slice(), ) } } @@ -243,7 +243,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener streamId, promisedId, Flags.END_HEADERS(flags), - buffer.slice() + buffer.slice(), ) } } @@ -301,7 +301,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener private[this] def decodeContinuationFrame( buffer: ByteBuffer, streamId: Int, - flags: Byte + flags: Byte, ): Result = if (streamId == 0) { val msg = "CONTINUATION frame with invalid stream dependency on 0x0" diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/FrameEncoder.scala b/http/src/main/scala/org/http4s/blaze/http/http2/FrameEncoder.scala index 1a0413c48..bc526bacd 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/FrameEncoder.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/FrameEncoder.scala @@ -81,7 +81,7 @@ private final class FrameEncoder(remoteSettings: Http2Settings, headerEncoder: H streamId: Int, priority: Priority, endStream: Boolean, - headers: Headers + headers: Headers, ): collection.Seq[ByteBuffer] = { val rawHeaders = headerEncoder.encodeHeaders(headers) @@ -96,7 +96,7 @@ private final class FrameEncoder(remoteSettings: Http2Settings, headerEncoder: H endHeaders = true, endStream, padding = 0, - rawHeaders + rawHeaders, ) else { // need to fragment @@ -110,7 +110,7 @@ private final class FrameEncoder(remoteSettings: Http2Settings, headerEncoder: H endHeaders = false, endStream, padding = 0, - headersBuf + headersBuf, ) while (rawHeaders.hasRemaining) { diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/FrameListener.scala b/http/src/main/scala/org/http4s/blaze/http/http2/FrameListener.scala index 4d66c722a..89347b704 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/FrameListener.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/FrameListener.scala @@ -77,7 +77,7 @@ private trait FrameListener { priority: Priority, endHeaders: Boolean, endStream: Boolean, - data: ByteBuffer + data: ByteBuffer, ): Result /** Called on successful receipt of a CONTINUATION frame @@ -140,7 +140,7 @@ private trait FrameListener { streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer + data: ByteBuffer, ): Result /** Called on successful receipt of a PING frame diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/FrameSerializer.scala b/http/src/main/scala/org/http4s/blaze/http/http2/FrameSerializer.scala index 99c96f86b..5d3f90839 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/FrameSerializer.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/FrameSerializer.scala @@ -48,7 +48,7 @@ private[http2] object FrameSerializer { streamId: Int, endStream: Boolean, padding: Int, - data: ByteBuffer + data: ByteBuffer, ): Seq[ByteBuffer] = { require(0 < streamId, "bad DATA frame stream id") require(0 <= padding && padding <= 256, "Invalid padding of DATA frame") @@ -79,7 +79,7 @@ private[http2] object FrameSerializer { endHeaders: Boolean, endStream: Boolean, padding: Int, - headerData: ByteBuffer + headerData: ByteBuffer, ): Seq[ByteBuffer] = { require(0 < streamId, "bad HEADER frame stream id") require(0 <= padding, "Invalid padding of HEADER frame") @@ -176,7 +176,7 @@ private[http2] object FrameSerializer { promiseId: Int, endHeaders: Boolean, padding: Int, - headerBuffer: ByteBuffer + headerBuffer: ByteBuffer, ): Seq[ByteBuffer] = { require(streamId != 0x0, "Invalid Stream id for PUSH_PROMISE frame") require(promiseId != 0x0 && promiseId % 2 == 0, "Invalid Stream id for PUSH_PROMISE frame") @@ -199,7 +199,7 @@ private[http2] object FrameSerializer { FrameTypes.PUSH_PROMISE, flags.toByte, streamId, - buffer + buffer, ) if (padded) @@ -250,7 +250,7 @@ private[http2] object FrameSerializer { require(0 <= streamId, "Invalid stream id for WINDOW_UPDATE") require( 0 < increment && increment <= Integer.MAX_VALUE, - "Invalid stream increment for WINDOW_UPDATE" + "Invalid stream increment for WINDOW_UPDATE", ) val size = 4 @@ -266,7 +266,7 @@ private[http2] object FrameSerializer { def mkContinuationFrame( streamId: Int, endHeaders: Boolean, - headerBuffer: ByteBuffer + headerBuffer: ByteBuffer, ): Seq[ByteBuffer] = { require(0 < streamId, "Invalid stream id for CONTINUATION frame") val flags: Byte = if (endHeaders) Flags.END_HEADERS else 0x0 @@ -306,7 +306,7 @@ private[http2] object FrameSerializer { frameType: Byte, flags: Byte, streamdId: Int, - buffer: ByteBuffer + buffer: ByteBuffer, ): Unit = { buffer .put((length >>> 16 & 0xff).toByte) diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListener.scala b/http/src/main/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListener.scala index 8ea275c16..93dc938c9 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListener.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListener.scala @@ -35,7 +35,7 @@ import Http2Exception.PROTOCOL_ERROR */ private abstract class HeaderAggregatingFrameListener( localSettings: Http2Settings, - headerDecoder: HeaderDecoder + headerDecoder: HeaderDecoder, ) extends FrameListener { private[this] sealed trait PartialFrame { def streamId: Int @@ -46,7 +46,7 @@ private abstract class HeaderAggregatingFrameListener( streamId: Int, priority: Priority, endStream: Boolean, - var buffer: ByteBuffer + var buffer: ByteBuffer, ) extends PartialFrame private[this] case class PPromise(streamId: Int, promisedId: Int, var buffer: ByteBuffer) @@ -71,7 +71,7 @@ private abstract class HeaderAggregatingFrameListener( streamId: Int, priority: Priority, endStream: Boolean, - headers: Headers + headers: Headers, ): Result /** Called on the successful receipt of a complete PUSH_PROMISE block @@ -97,7 +97,7 @@ private abstract class HeaderAggregatingFrameListener( priority: Priority, endHeaders: Boolean, endStream: Boolean, - buffer: ByteBuffer + buffer: ByteBuffer, ): Result = if (inHeaderSequence) Error( @@ -124,7 +124,7 @@ private abstract class HeaderAggregatingFrameListener( streamId: Int, promisedId: Int, endHeaders: Boolean, - buffer: ByteBuffer + buffer: ByteBuffer, ): Result = if (localSettings.maxHeaderListSize < buffer.remaining) headerSizeError(buffer.remaining, streamId) @@ -143,7 +143,7 @@ private abstract class HeaderAggregatingFrameListener( override final def onContinuationFrame( streamId: Int, endHeaders: Boolean, - buffer: ByteBuffer + buffer: ByteBuffer, ): Result = if (hInfo.streamId != streamId) { val msg = "Invalid CONTINUATION frame: stream Id's don't match. " + diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/HeaderDecoder.scala b/http/src/main/scala/org/http4s/blaze/http/http2/HeaderDecoder.scala index 4add9dfc2..2b8361dc2 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/HeaderDecoder.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/HeaderDecoder.scala @@ -41,7 +41,7 @@ import scala.util.control.NonFatal private final class HeaderDecoder( maxHeaderListSize: Int, discardOverflowHeaders: Boolean, - val maxTableSize: Int + val maxTableSize: Int, ) { require(maxTableSize >= DefaultSettings.HEADER_TABLE_SIZE) @@ -92,7 +92,7 @@ private final class HeaderDecoder( buffer: ByteBuffer, streamId: Int, endHeaders: Boolean, - listener: HeaderListener + listener: HeaderListener, ): MaybeError = { if (sawEndHeaders) throw new IllegalStateException("called doDecode() after receiving an endHeaders flag") diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/Http2Settings.scala b/http/src/main/scala/org/http4s/blaze/http/http2/Http2Settings.scala index bbb2593f8..54ab63fb3 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/Http2Settings.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/Http2Settings.scala @@ -75,7 +75,7 @@ sealed abstract class Http2Settings { MAX_CONCURRENT_STREAMS(maxConcurrentStreams), INITIAL_WINDOW_SIZE(initialWindowSize), MAX_FRAME_SIZE(maxFrameSize), - MAX_HEADER_LIST_SIZE(maxHeaderListSize) + MAX_HEADER_LIST_SIZE(maxHeaderListSize), ) override def toString: String = s"Http2Settings($toSeq)" @@ -88,7 +88,7 @@ case class ImmutableHttp2Settings( pushEnabled: Boolean, maxConcurrentStreams: Int, maxFrameSize: Int, - maxHeaderListSize: Int + maxHeaderListSize: Int, ) extends Http2Settings object Http2Settings { @@ -123,7 +123,7 @@ object Http2Settings { pushEnabled = DefaultSettings.ENABLE_PUSH, // initially enabled maxConcurrentStreams = DefaultSettings.MAX_CONCURRENT_STREAMS, // initially unbounded maxFrameSize = DefaultSettings.MAX_FRAME_SIZE, - maxHeaderListSize = DefaultSettings.MAX_HEADER_LIST_SIZE + maxHeaderListSize = DefaultSettings.MAX_HEADER_LIST_SIZE, ) private def settingKey(id: Int): SettingKey = @@ -198,7 +198,7 @@ private[blaze] final class MutableHttp2Settings private ( var pushEnabled: Boolean, var maxConcurrentStreams: Int, var maxFrameSize: Int, - var maxHeaderListSize: Int + var maxHeaderListSize: Int, ) extends Http2Settings { // initially unbounded import MutableHttp2Settings._ @@ -240,7 +240,7 @@ private object MutableHttp2Settings { pushEnabled = settings.pushEnabled, maxConcurrentStreams = settings.maxConcurrentStreams, maxFrameSize = settings.maxFrameSize, - maxHeaderListSize = settings.maxHeaderListSize + maxHeaderListSize = settings.maxHeaderListSize, ) /** Create a new [[MutableHttp2Settings]] using the HTTP2 defaults */ diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/InboundStreamStateImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/InboundStreamStateImpl.scala index cbd58c3bf..cfc93fadc 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/InboundStreamStateImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/InboundStreamStateImpl.scala @@ -19,7 +19,7 @@ package org.http4s.blaze.http.http2 private final class InboundStreamStateImpl( session: SessionCore, val streamId: Int, - val flowWindow: StreamFlowWindow + val flowWindow: StreamFlowWindow, ) extends StreamStateImpl(session) with InboundStreamState { override def name: String = s"InboundStreamState($streamId)" diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/PingManager.scala b/http/src/main/scala/org/http4s/blaze/http/http2/PingManager.scala index e984d965f..5e66a7002 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/PingManager.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/PingManager.scala @@ -64,9 +64,11 @@ private class PingManager(session: SessionCore) { case Pinging(sent, continuation) => state = Idle - if (ByteBuffer + if ( + ByteBuffer .wrap(data) - .getLong != sent) { // data guaranteed to be 8 bytes + .getLong != sent + ) { // data guaranteed to be 8 bytes val msg = "Received ping response with unknown data." val ex = new Exception(msg) logger.warn(ex)(msg) diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/SessionFlowControlImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/SessionFlowControlImpl.scala index e45123c7c..d8344f06e 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/SessionFlowControlImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/SessionFlowControlImpl.scala @@ -23,7 +23,7 @@ import org.log4s.getLogger /** Flow control representation of a Http2 Session */ private class SessionFlowControlImpl( session: SessionCore, - flowStrategy: FlowStrategy + flowStrategy: FlowStrategy, ) extends SessionFlowControl { private[this] val logger = getLogger diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/SessionFrameListener.scala b/http/src/main/scala/org/http4s/blaze/http/http2/SessionFrameListener.scala index e9d305272..c4da0174e 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/SessionFrameListener.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/SessionFrameListener.scala @@ -31,7 +31,7 @@ import org.http4s.blaze.http.http2.Http2Settings.Setting private class SessionFrameListener( session: SessionCore, isClient: Boolean, - headerDecoder: HeaderDecoder + headerDecoder: HeaderDecoder, ) extends HeaderAggregatingFrameListener(session.localSettings, headerDecoder) { // Concrete methods //////////////////////////////////////////////////////////////////// @@ -39,7 +39,7 @@ private class SessionFrameListener( streamId: Int, priority: Priority, endStream: Boolean, - headers: Headers + headers: Headers, ): Result = session.streamManager.get(streamId) match { case Some(stream) => @@ -57,7 +57,7 @@ private class SessionFrameListener( override def onCompletePushPromiseFrame( streamId: Int, promisedId: Int, - headers: Headers + headers: Headers, ): Result = if (!isClient) // A client cannot push. Thus, servers MUST treat the receipt of a diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/SettingsDecoder.scala b/http/src/main/scala/org/http4s/blaze/http/http2/SettingsDecoder.scala index c7c775ba0..ebff09308 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/SettingsDecoder.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/SettingsDecoder.scala @@ -69,7 +69,7 @@ private[blaze] object SettingsDecoder { def decodeSettingsFrame( buffer: ByteBuffer, streamId: Int, - flags: Byte + flags: Byte, ): Either[Http2Exception, SettingsFrame] = { import Http2Exception._ diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/StreamIdManager.scala b/http/src/main/scala/org/http4s/blaze/http/http2/StreamIdManager.scala index 1585389a2..6c3190901 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/StreamIdManager.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/StreamIdManager.scala @@ -35,7 +35,7 @@ private[http2] object StreamIdManager { private final class StreamIdManager private ( isClient: Boolean, private var nextInbound: Int, - private var nextOutbound: Int + private var nextOutbound: Int, ) { /** Get the last inbound stream to be observed, or 0 if no streams have been processed */ diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/StreamManagerImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/StreamManagerImpl.scala index a92282794..60e390bf8 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/StreamManagerImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/StreamManagerImpl.scala @@ -24,7 +24,7 @@ import scala.concurrent.{Future, Promise} private final class StreamManagerImpl( session: SessionCore, - inboundStreamBuilder: Option[Int => LeafBuilder[StreamFrame]] + inboundStreamBuilder: Option[Int => LeafBuilder[StreamFrame]], ) extends StreamManager { private[this] val logger = org.log4s.getLogger private[this] val streams = new HashMap[Int, StreamState] diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/StreamStateImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/StreamStateImpl.scala index 927881cd7..9b3099d95 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/StreamStateImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/StreamStateImpl.scala @@ -212,7 +212,7 @@ private abstract class StreamStateImpl(session: SessionCore) extends StreamState override final def invokeInboundData( endStream: Boolean, data: ByteBuffer, - flowBytes: Int + flowBytes: Int, ): MaybeError = if (receivedEndStream) // https://tools.ietf.org/html/rfc7540#section-5.1 section 'half-closed' @@ -237,7 +237,7 @@ private abstract class StreamStateImpl(session: SessionCore) extends StreamState override final def invokeInboundHeaders( priority: Priority, endStream: Boolean, - headers: Headers + headers: Headers, ): MaybeError = if (receivedEndStream) // https://tools.ietf.org/html/rfc7540#section-5.1 section 'half-closed' diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/WriteControllerImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/WriteControllerImpl.scala index 2c8a96606..a890423e0 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/WriteControllerImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/WriteControllerImpl.scala @@ -40,7 +40,7 @@ import scala.util.control.NonFatal private final class WriteControllerImpl( session: SessionCore, highWaterMark: Int, - tailStage: TailStage[ByteBuffer] + tailStage: TailStage[ByteBuffer], ) extends WriteController { import WriteControllerImpl._ @@ -109,7 +109,7 @@ private final class WriteControllerImpl( private[this] def addBuffs( dest: ArrayBuffer[ByteBuffer], - data: collection.Seq[ByteBuffer] + data: collection.Seq[ByteBuffer], ): Int = { var written = 0 data.foreach { buf => diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/server/ALPNServerSelector.scala b/http/src/main/scala/org/http4s/blaze/http/http2/server/ALPNServerSelector.scala index 22095b471..d9291189d 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/server/ALPNServerSelector.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/server/ALPNServerSelector.scala @@ -39,7 +39,7 @@ import scala.util.control.NonFatal final class ALPNServerSelector( engine: SSLEngine, selector: Set[String] => String, - builder: String => LeafBuilder[ByteBuffer] + builder: String => LeafBuilder[ByteBuffer], ) extends TailStage[ByteBuffer] { engine.setHandshakeApplicationProtocolSelector( diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/server/ServerPriorKnowledgeHandshaker.scala b/http/src/main/scala/org/http4s/blaze/http/http2/server/ServerPriorKnowledgeHandshaker.scala index 21eba12d1..26e38531c 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/server/ServerPriorKnowledgeHandshaker.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/server/ServerPriorKnowledgeHandshaker.scala @@ -28,7 +28,7 @@ import scala.util.Failure final class ServerPriorKnowledgeHandshaker( localSettings: ImmutableHttp2Settings, flowStrategy: FlowStrategy, - nodeBuilder: Int => LeafBuilder[StreamFrame] + nodeBuilder: Int => LeafBuilder[StreamFrame], ) extends PriorKnowledgeHandshaker[Unit](localSettings) { override protected def stageStartup(): Unit = synchronized { @@ -43,7 +43,7 @@ final class ServerPriorKnowledgeHandshaker( override protected def handshakeComplete( remoteSettings: MutableHttp2Settings, - data: ByteBuffer + data: ByteBuffer, ): Future[Unit] = Future(installHttp2ServerStage(remoteSettings, data)) @@ -64,7 +64,7 @@ final class ServerPriorKnowledgeHandshaker( // Setup the pipeline with a new Http2ClientStage and start it up, then return it. private def installHttp2ServerStage( remoteSettings: MutableHttp2Settings, - remainder: ByteBuffer + remainder: ByteBuffer, ): Unit = { logger.debug(s"Installing pipeline with settings: $remoteSettings") val tail = new BasicTail[ByteBuffer]("http2ServerTail") @@ -83,7 +83,7 @@ final class ServerPriorKnowledgeHandshaker( remoteSettings = remoteSettings, flowStrategy = flowStrategy, inboundStreamBuilder = Some(nodeBuilder), - parentExecutor = Execution.trampoline + parentExecutor = Execution.trampoline, ) () } diff --git a/http/src/main/scala/org/http4s/blaze/http/util/HeaderTools.scala b/http/src/main/scala/org/http4s/blaze/http/util/HeaderTools.scala index dd2f55bd1..cee5ddd3a 100644 --- a/http/src/main/scala/org/http4s/blaze/http/util/HeaderTools.scala +++ b/http/src/main/scala/org/http4s/blaze/http/util/HeaderTools.scala @@ -50,7 +50,7 @@ private[blaze] object HeaderTools { case class SpecialHeaders( transferEncoding: Option[String], contentLength: Option[String], - connection: Option[String] + connection: Option[String], ) def isKeepAlive(connectionHeader: Option[String], minorVersion: Int): Boolean = @@ -105,7 +105,7 @@ private[blaze] object HeaderTools { SpecialHeaders( transferEncoding, contentLength, - connection + connection, ) } } diff --git a/http/src/test/scala/org/http4s/blaze/http/BodyReaderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/BodyReaderSuite.scala index b32f461e3..56ca62ea3 100644 --- a/http/src/test/scala/org/http4s/blaze/http/BodyReaderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/BodyReaderSuite.scala @@ -66,7 +66,7 @@ class BodyReaderSuite extends BlazeTestSuite { test("A BodyReader.accumulate(max, bodyReader) should accumulate multiple buffers") { val reader = new MultiByteReader( ByteBuffer.allocate(10), - ByteBuffer.allocate(1) + ByteBuffer.allocate(1), ) val bytes = BodyReader.accumulate(Int.MaxValue, reader).map(_.remaining()) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/ConnectionImplSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/ConnectionImplSuite.scala index c8510154a..e0d4e134e 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/ConnectionImplSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/ConnectionImplSuite.scala @@ -53,7 +53,7 @@ class ConnectionImplSuite extends BlazeTestSuite { remoteSettings = remoteSettings, flowStrategy = flowStrategy, inboundStreamBuilder = streamBuilder, - parentExecutor = Execution.trampoline + parentExecutor = Execution.trampoline, ) def decodeGoAway(data: ByteBuffer): ProtocolFrame = diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/FrameDecoderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/FrameDecoderSuite.scala index 8aea65dc1..472c864d0 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/FrameDecoderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/FrameDecoderSuite.scala @@ -37,7 +37,7 @@ class FrameDecoderSuite extends BlazeTestSuite { streamId: Int, endStream: Boolean, data: ByteBuffer, - flowSize: Int + flowSize: Int, ): Result = { this.streamId = Some(streamId) this.endStream = Some(endStream) @@ -82,7 +82,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, // length 0x00, // type 0x00, // flags - 0x00, 0x00, 0x00, 0x01 // streamId + 0x00, 0x00, 0x00, 0x01, // streamId ) // no data val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -114,7 +114,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00 + 0x00, ) val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -143,7 +143,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00 + 0x00, ) val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -175,7 +175,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00 + 0x00, ) val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -207,7 +207,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00 + 0x00, ) val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -245,7 +245,7 @@ class FrameDecoderSuite extends BlazeTestSuite { priority: Priority, end_headers: Boolean, end_stream: Boolean, - buffer: ByteBuffer + buffer: ByteBuffer, ): Result = { this.streamId = Some(streamId) this.priority = Some(priority) @@ -305,7 +305,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0xff.toByte, // weight 0x00, 0x00, - 0x00 + 0x00, ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -337,7 +337,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00 + 0x00, ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -369,7 +369,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x02, // dependent stream 2, non-exclusive 0x02, // weight 3 0x00, - 0x01 + 0x01, ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -401,7 +401,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x01 + 0x01, ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -449,7 +449,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x02, // weight 3 0x00, 0x00, - 0x01 + 0x01, ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -479,7 +479,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x02, // weight 3 0x00, 0x00, - 0x01 + 0x01, ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -534,7 +534,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x02, // stream dependency 2 - 0x00 + 0x00, ) val listener = new PriorityListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -586,7 +586,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x02, // type 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId - 0x00, 0x00, 0x00, 0x02 // stream dependency + 0x00, 0x00, 0x00, 0x02, // stream dependency ) // missing weight val listener = new PriorityListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -618,7 +618,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x03, // type 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId - 0x00, 0x00, 0x00, 0x02 // code + 0x00, 0x00, 0x00, 0x02, // code ) // missing weight val listener = new RstListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -635,7 +635,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x03, // type 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId - 0x00, 0x00, 0x00, 0x00 // code + 0x00, 0x00, 0x00, 0x00, // code ) // missing weight val listener = new RstListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -653,7 +653,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x03, // type 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId - 0x00, 0x00, 0x00 // code + 0x00, 0x00, 0x00, // code ) // missing weight val listener = new RstListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -671,7 +671,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x03, // type 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId - 0x00, 0x00, 0x00, 0x00, 0x00 // code + 0x00, 0x00, 0x00, 0x00, 0x00, // code ) // missing weight val listener = new RstListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -702,7 +702,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, // length 0x04, // type 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // streamId + 0x00, 0x00, 0x00, 0x00, // streamId // body ) val listener = new SettingsListener @@ -723,7 +723,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00 // streamId + 0x00, // streamId // body ) val listener = new SettingsListener @@ -741,7 +741,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId 0x00, 0x00, // key - 0x00, 0x00, 0x00, 0x01 // value + 0x00, 0x00, 0x00, 0x01, // value // body ) val listener = new SettingsListener @@ -757,7 +757,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, // length 0x04, // type 0x00, // flags - 0x00, 0x00, 0x00, 0x01 // streamId + 0x00, 0x00, 0x00, 0x01, // streamId // body ) // missing weight val listener = new SettingsListener @@ -786,7 +786,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x01 // value + 0x01, // value // body ) val listener = new SettingsListener @@ -806,7 +806,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, ) // missing weight val listener = new SettingsListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -826,7 +826,7 @@ class FrameDecoderSuite extends BlazeTestSuite { streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer + data: ByteBuffer, ): Result = { this.streamId = Some(streamId) this.promisedId = Some(promisedId) @@ -854,7 +854,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x02 // promised id + 0x00, 0x00, 0x00, 0x02, // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -882,7 +882,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x02 // promised id + 0x02, // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -911,7 +911,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x02 // promised id + 0x02, // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -942,7 +942,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x02, // promised id 0x00, - 0x01 // the padding + 0x01, // the padding ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -962,7 +962,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x00, 0x00, 0x00, 0x02 // promised id + 0x00, 0x00, 0x00, 0x02, // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -981,7 +981,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x01 // promised id + 0x00, 0x00, 0x00, 0x01, // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1000,7 +1000,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x01 // promised id + 0x00, 0x00, 0x00, 0x01, // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1037,7 +1037,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x00, // opaque data - 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1067,7 +1067,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00 + 0x00, ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1086,7 +1086,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x01, // streamId // body 0x00, 0x00, 0x00, 0x00, // opaque data - 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1106,7 +1106,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x00, // opaque data - 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1126,7 +1126,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x00, // opaque data - 0x00, 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, 0x00, ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1166,7 +1166,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x01, // last stream - 0x00, 0x00, 0x00, 0x00 // error code + 0x00, 0x00, 0x00, 0x00, // error code ) val listener = new GoAwayListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1187,7 +1187,7 @@ class FrameDecoderSuite extends BlazeTestSuite { // body 0x00, 0x00, 0x00, 0x01, // last stream 0x00, 0x00, 0x00, 0x00, // error code - 0x01 + 0x01, ) val listener = new GoAwayListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1208,7 +1208,7 @@ class FrameDecoderSuite extends BlazeTestSuite { // body 0x00, 0x00, 0x00, 0x01, // last stream 0x00, 0x00, 0x00, 0x00, // error code - 0x01 + 0x01, ) val listener = new GoAwayListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1241,7 +1241,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x00, 0x00, 0x00, 0x01 // increment + 0x00, 0x00, 0x00, 0x01, // increment ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1259,7 +1259,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x00, 0x00, 0x00, 0x00 // increment + 0x00, 0x00, 0x00, 0x00, // increment ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1278,7 +1278,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x00 // increment + 0x00, 0x00, 0x00, 0x00, // increment ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1297,7 +1297,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x00, 0x00, 0x00 // increment + 0x00, 0x00, 0x00, // increment ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1317,7 +1317,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x01, // increment - 0x00 + 0x00, ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1335,7 +1335,7 @@ class FrameDecoderSuite extends BlazeTestSuite { override def onContinuationFrame( streamId: Int, endHeaders: Boolean, - data: ByteBuffer + data: ByteBuffer, ): Result = { this.streamId = Some(streamId) this.endHeaders = Some(endHeaders) @@ -1356,7 +1356,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x01 // increment + 0x01, // increment ) val listener = new ContinuationListener(true) val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1375,7 +1375,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x01 // increment + 0x01, // increment ) val listener = new ContinuationListener(true) val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1399,7 +1399,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x01, // streamId // body - 0x01 // increment + 0x01, // increment ) val listener = new ContinuationListener(true) val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1423,7 +1423,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x01, // streamId // body - 0x01 // increment + 0x01, // increment ) val listener = new ContinuationListener(false) val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1455,7 +1455,7 @@ class FrameDecoderSuite extends BlazeTestSuite { _code: Byte, _streamId: Int, _flags: Byte, - buffer: ByteBuffer + buffer: ByteBuffer, ): Result = { data = buffer code = Some(_code) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/FrameEncoderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/FrameEncoderSuite.scala index 48eb66bb9..b5d2c5d2e 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/FrameEncoderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/FrameEncoderSuite.scala @@ -32,7 +32,7 @@ class FrameEncoderSuite extends BlazeTestSuite { onHeadersFrameMock: (Int, Priority, Boolean, Boolean, ByteBuffer) => Result = (_, _, _, _, _) => BufferUnderflow, inHeaderSequenceMock: Boolean = false, - onContinuationFrameMock: (Int, Boolean, ByteBuffer) => Result = (_, _, _) => BufferUnderflow + onContinuationFrameMock: (Int, Boolean, ByteBuffer) => Result = (_, _, _) => BufferUnderflow, ) = new FrameListener { def inHeaderSequence: Boolean = inHeaderSequenceMock @@ -44,7 +44,7 @@ class FrameEncoderSuite extends BlazeTestSuite { priority: Priority, endHeaders: Boolean, endStream: Boolean, - data: ByteBuffer + data: ByteBuffer, ): Result = onHeadersFrameMock(streamId, priority, endHeaders, endStream, data) @@ -61,7 +61,7 @@ class FrameEncoderSuite extends BlazeTestSuite { streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer + data: ByteBuffer, ): Result = ??? def onPingFrame(ack: Boolean, data: Array[Byte]): Result = ??? @@ -199,7 +199,7 @@ class FrameEncoderSuite extends BlazeTestSuite { case (1, true, `zeroBuffer5`) => ReturnTag(2) case _ => throw new IllegalStateException("Unexpected arguments for onContinuationFrame") }, - inHeaderSequenceMock = true + inHeaderSequenceMock = true, ) val decoder2 = new FrameDecoder(tools.remoteSettings, listener2) @@ -238,7 +238,7 @@ class FrameEncoderSuite extends BlazeTestSuite { case (1, true, `zeroBuffer5`) => ReturnTag(2) case _ => throw new IllegalStateException("Unexpected arguments for onHeadersFrame") }, - inHeaderSequenceMock = true + inHeaderSequenceMock = true, ) val decoder2 = new FrameDecoder(tools.remoteSettings, listener2) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/FrameSerializerSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/FrameSerializerSuite.scala index c74dbb654..a6f1e15db 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/FrameSerializerSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/FrameSerializerSuite.scala @@ -59,7 +59,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { streamId: Int, isLast: Boolean, data: ByteBuffer, - flowSize: Int + flowSize: Int, ): org.http4s.blaze.http.http2.Result = { assertEquals(streamId, dataFrame.streamId) assertEquals(isLast, dataFrame.endStream) @@ -78,7 +78,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { dataFrame.streamId, dataFrame.endStream, dataFrame.padding, - dataFrame.data.duplicate() + dataFrame.data.duplicate(), ) ) dec(dataFrame).decodeBuffer(frame) == Continue @@ -99,7 +99,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { endHeaders: Boolean, endStream: Boolean, data: ByteBuffer, - padding: Int + padding: Int, ) { def flowSize: Int = data.remaining + padding } @@ -127,7 +127,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { priority: Priority, end_headers: Boolean, end_stream: Boolean, - buffer: ByteBuffer + buffer: ByteBuffer, ): org.http4s.blaze.http.http2.Result = { assertEquals(headerFrame.streamId, streamId) assertEquals(headerFrame.priority, priority) @@ -149,7 +149,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { headerFrame.endHeaders, headerFrame.endStream, headerFrame.padding, - headerFrame.data.duplicate + headerFrame.data.duplicate, ) ) @@ -163,7 +163,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { assertEquals( dec(HeadersFrame(1, Priority.NoPriority, true, true, dat, 0)) .decodeBuffer(buff1), - Continue + Continue, ) assertEquals(buff1.remaining(), 0) @@ -181,7 +181,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { assertEquals( dec(HeadersFrame(1, Priority.NoPriority, true, true, dat, paddingSize)) .decodeBuffer(buff), - Continue + Continue, ) } @@ -205,7 +205,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { decoder(new MockFrameListener(false) { override def onPriorityFrame( streamId: Int, - priority: Priority.Dependent + priority: Priority.Dependent, ): org.http4s.blaze.http.http2.Result = { assertEquals(priorityFrame.streamId, streamId) assertEquals(priorityFrame.priority, priority) @@ -254,7 +254,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { decoder(new MockFrameListener(false) { override def onRstStreamFrame( streamId: Int, - code: Long + code: Long, ): org.http4s.blaze.http.http2.Result = { assertEquals(rstFrame.streamId, streamId) assertEquals(rstFrame.code, code) @@ -311,7 +311,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { decoder(new MockHeaderAggregatingFrameListener { override def onPingFrame( ack: Boolean, - data: Array[Byte] + data: Array[Byte], ): org.http4s.blaze.http.http2.Result = { assertEquals(pingFrame.ack, ack) assert(util.Arrays.equals(pingFrame.data, data)) @@ -342,7 +342,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { override def onGoAwayFrame( lastStream: Int, errorCode: Long, - debugData: Array[Byte] + debugData: Array[Byte], ): org.http4s.blaze.http.http2.Result = { assertEquals(goAway.lastStream, lastStream) assertEquals(goAway.err, errorCode) @@ -371,7 +371,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { decoder(new MockHeaderAggregatingFrameListener { override def onWindowUpdateFrame( streamId: Int, - sizeIncrement: Int + sizeIncrement: Int, ): org.http4s.blaze.http.http2.Result = { assertEquals(update.streamId, streamId) assertEquals(update.increment, sizeIncrement) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListenerSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListenerSuite.scala index 955ba8e3f..2756e1eb7 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListenerSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListenerSuite.scala @@ -38,7 +38,7 @@ class HeaderAggregatingFrameListenerSuite extends BlazeTestSuite { streamId: Int, priority: Priority, end_stream: Boolean, - headers: Headers + headers: Headers, ): Result = { assertEquals(sId, streamId) assertEquals(p, priority) @@ -56,7 +56,7 @@ class HeaderAggregatingFrameListenerSuite extends BlazeTestSuite { assertEquals( mkDecoder(1, Priority.NoPriority, true, hs).decodeBuffer(BufferTools.joinBuffers(bs)), - Halt + Halt, ) } @@ -157,7 +157,7 @@ class HeaderAggregatingFrameListenerSuite extends BlazeTestSuite { streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer + data: ByteBuffer, ): Result = { assertEquals(sId, streamId) assertEquals(pId, promisedId) @@ -198,7 +198,7 @@ class HeaderAggregatingFrameListenerSuite extends BlazeTestSuite { override def onCompletePushPromiseFrame( streamId: Int, promisedId: Int, - headers: Headers + headers: Headers, ): Result = { assertEquals(sId, streamId) assertEquals(pId, promisedId) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderDecoderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderDecoderSuite.scala index c228154c5..e4ee4380b 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderDecoderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderDecoderSuite.scala @@ -74,11 +74,11 @@ class HeaderDecoderSuite extends BlazeTestSuite { test("A HeaderDecoder should now overflow the maxHeaderBlockSize") { val bb = HeaderCodecHelpers.encodeHeaders( testHeaders ++ testHeaders, - Http2Settings.DefaultSettings.HEADER_TABLE_SIZE + Http2Settings.DefaultSettings.HEADER_TABLE_SIZE, ) val dec = new HeaderDecoder( headersBlockSize, /*discardOnOverflow*/ true, - Http2Settings.DefaultSettings.HEADER_TABLE_SIZE + Http2Settings.DefaultSettings.HEADER_TABLE_SIZE, ) assertEquals(dec.decode(bb, -1, true), Continue) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderEncoderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderEncoderSuite.scala index f1e64312d..2417c843e 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderEncoderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderEncoderSuite.scala @@ -27,7 +27,7 @@ class HeaderEncoderSuite extends BlazeTestSuite { assertEquals( HeaderCodecHelpers.decodeHeaders(bb, Http2Settings.DefaultSettings.HEADER_TABLE_SIZE), - headers + headers, ) } } diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/ProtocolFrameDecoder.scala b/http/src/test/scala/org/http4s/blaze/http/http2/ProtocolFrameDecoder.scala index e0d9ea1fd..c0ada3f65 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/ProtocolFrameDecoder.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/ProtocolFrameDecoder.scala @@ -47,7 +47,7 @@ private[http2] object ProtocolFrameDecoder { def decode( buffer: ByteBuffer, inHeadersSequence: Boolean = false, - maxFrameSize: Int = Http2Settings.default.maxFrameSize + maxFrameSize: Int = Http2Settings.default.maxFrameSize, ): ProtocolFrame = { val listener = new Listener(inHeadersSequence) val decoder = new FrameDecoder(toSettings(maxFrameSize), listener) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/ServerPriorKnowledgeHandshakerSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/ServerPriorKnowledgeHandshakerSuite.scala index 776a11b0d..5b590e3f7 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/ServerPriorKnowledgeHandshakerSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/ServerPriorKnowledgeHandshakerSuite.scala @@ -32,7 +32,7 @@ class ServerPriorKnowledgeHandshakerSuite extends BlazeTestSuite { new ServerPriorKnowledgeHandshaker( localSettings = localSettings, flowStrategy = flowStrategy, - nodeBuilder = _ => ??? + nodeBuilder = _ => ???, ) } diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/SessionFlowControlSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/SessionFlowControlSuite.scala index ab88af612..9ed68015c 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/SessionFlowControlSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/SessionFlowControlSuite.scala @@ -312,7 +312,7 @@ class SessionFlowControlSuite extends BlazeTestSuite { assertEquals( flow.outboundRequest(DefaultSettings.INITIAL_WINDOW_SIZE), - DefaultSettings.INITIAL_WINDOW_SIZE + DefaultSettings.INITIAL_WINDOW_SIZE, ) assertEquals(flow.streamOutboundWindow, 0) assertEquals(session.sessionOutboundWindow, 0) @@ -324,7 +324,7 @@ class SessionFlowControlSuite extends BlazeTestSuite { assertEquals( flow.outboundRequest(DefaultSettings.INITIAL_WINDOW_SIZE + 1), - DefaultSettings.INITIAL_WINDOW_SIZE + DefaultSettings.INITIAL_WINDOW_SIZE, ) assertEquals(flow.streamOutboundWindow, 0) assertEquals(session.sessionOutboundWindow, 0) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/SessionFrameListenerSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/SessionFrameListenerSuite.scala index 19769e336..295925f72 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/SessionFrameListenerSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/SessionFrameListenerSuite.scala @@ -34,7 +34,7 @@ class SessionFrameListenerSuite extends BlazeTestSuite { new HeaderDecoder( localSettings.maxHeaderListSize, true, // discard overflow headers - localSettings.headerTableSize + localSettings.headerTableSize, ) lazy val newInboundStream: Option[Int => LeafBuilder[StreamFrame]] = None @@ -58,7 +58,7 @@ class SessionFrameListenerSuite extends BlazeTestSuite { streamId = os.streamId, priority = Priority.NoPriority, endStream = false, - headers = hs + headers = hs, ) os.readRequest(1).value match { @@ -83,7 +83,7 @@ class SessionFrameListenerSuite extends BlazeTestSuite { streamId = 1, priority = Priority.NoPriority, endStream = false, - headers = hs + headers = hs, ) assert(tools.streamManager.get(1).isDefined) @@ -128,7 +128,7 @@ class SessionFrameListenerSuite extends BlazeTestSuite { override def handlePushPromise( streamId: Int, promisedId: Int, - headers: Headers + headers: Headers, ) = { sId = streamId pId = promisedId @@ -294,14 +294,14 @@ class SessionFrameListenerSuite extends BlazeTestSuite { val tools = new MockTools(true) { override def invokeGoAway( lastHandledOutboundStream: Int, - reason: Http2SessionException + reason: Http2SessionException, ): Unit = observedGoAway = Some(lastHandledOutboundStream -> reason) } assertEquals( tools.frameListener.onGoAwayFrame(1, NO_ERROR.code, "lol".getBytes(StandardCharsets.UTF_8)), - Continue + Continue, ) observedGoAway match { diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/StreamFlowWindowSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/StreamFlowWindowSuite.scala index 407a0f352..16654970c 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/StreamFlowWindowSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/StreamFlowWindowSuite.scala @@ -52,7 +52,7 @@ class StreamFlowWindowSuite extends BlazeTestSuite { tools.sessionFlowControl .newStreamFlowWindow(1) .outboundRequest(initialSessionWindow), - initialSessionWindow + initialSessionWindow, ) assertEquals(window.outboundWindow, 0) } @@ -89,7 +89,7 @@ class StreamFlowWindowSuite extends BlazeTestSuite { tools.sessionFlowControl .newStreamFlowWindow(1) .outboundRequest(initialSessionWindow), - initialSessionWindow + initialSessionWindow, ) assertEquals(window2.outboundWindowAvailable, false) // both depleted diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/StreamStateImplSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/StreamStateImplSuite.scala index 47157c92e..aabada175 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/StreamStateImplSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/StreamStateImplSuite.scala @@ -40,7 +40,7 @@ class StreamStateImplSuite extends BlazeTestSuite { } override protected def onStreamBytesConsumed( stream: StreamFlowWindow, - consumed: Int + consumed: Int, ): Unit = { streamConsumed += consumed () @@ -53,7 +53,7 @@ class StreamStateImplSuite extends BlazeTestSuite { lazy val streamState: StreamStateImpl = new InboundStreamStateImpl( session = tools, streamId = streamId, - flowWindow = tools.sessionFlowControl.newStreamFlowWindow(streamId) + flowWindow = tools.sessionFlowControl.newStreamFlowWindow(streamId), ) } @@ -202,7 +202,7 @@ class StreamStateImplSuite extends BlazeTestSuite { assertEquals( streamState .invokeInboundData(endStream = false, data = BufferTools.allocate(1), flowBytes = 1), - Continue + Continue, ) assertEquals(streamConsumed.dequeue(), 1) @@ -250,7 +250,7 @@ class StreamStateImplSuite extends BlazeTestSuite { streamState.invokeInboundData( endStream = false, data = BufferTools.emptyBuffer, - flowBytes = streamState.flowWindow.streamInboundWindow + 1 + flowBytes = streamState.flowWindow.streamInboundWindow + 1, ) match { case Error(ex: Http2SessionException) => assertEquals(ex.code, Http2Exception.FLOW_CONTROL_ERROR.code) @@ -282,7 +282,7 @@ class StreamStateImplSuite extends BlazeTestSuite { streamState.invokeInboundData( endStream = false, data = BufferTools.emptyBuffer, - flowBytes = tools.sessionFlowControl.sessionInboundWindow + 1 + flowBytes = tools.sessionFlowControl.sessionInboundWindow + 1, ) match { case Error(ex: Http2SessionException) => assertEquals(ex.code, Http2Exception.FLOW_CONTROL_ERROR.code) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockFrameListener.scala b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockFrameListener.scala index 0dc247a46..09b1e14e6 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockFrameListener.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockFrameListener.scala @@ -29,7 +29,7 @@ private[http2] class MockFrameListener(inHeaders: Boolean) extends FrameListener streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer + data: ByteBuffer, ): Result = ??? // For handling unknown stream frames @@ -38,7 +38,7 @@ private[http2] class MockFrameListener(inHeaders: Boolean) extends FrameListener priority: Priority, end_headers: Boolean, end_stream: Boolean, - buffer: ByteBuffer + buffer: ByteBuffer, ): Result = ??? override def onSettingsFrame(settings: Option[Seq[Setting]]): Result = ??? override def onRstStreamFrame(streamId: Int, code: Long): Result = ??? @@ -49,7 +49,7 @@ private[http2] class MockFrameListener(inHeaders: Boolean) extends FrameListener streamId: Int, isLast: Boolean, data: ByteBuffer, - flowSize: Int + flowSize: Int, ): Result = ??? override def onWindowUpdateFrame(streamId: Int, sizeIncrement: Int): Result = ??? } diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockHeaderAggregatingFrameListener.scala b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockHeaderAggregatingFrameListener.scala index 53823a1f3..230df717e 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockHeaderAggregatingFrameListener.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockHeaderAggregatingFrameListener.scala @@ -25,18 +25,18 @@ import org.http4s.blaze.http.http2._ private[http2] class MockHeaderAggregatingFrameListener extends HeaderAggregatingFrameListener( Http2Settings.default, - new HeaderDecoder(20 * 1024, true, 4096) + new HeaderDecoder(20 * 1024, true, 4096), ) { override def onCompletePushPromiseFrame( streamId: Int, promisedId: Int, - headers: Headers + headers: Headers, ): Result = ??? override def onCompleteHeadersFrame( streamId: Int, priority: Priority, end_stream: Boolean, - headers: Headers + headers: Headers, ): Result = ??? override def onGoAwayFrame(lastStream: Int, errorCode: Long, debugData: Array[Byte]): Result = ??? override def onPingFrame(ack: Boolean, data: Array[Byte]): Result = ??? @@ -48,7 +48,7 @@ private[http2] class MockHeaderAggregatingFrameListener streamId: Int, isLast: Boolean, data: ByteBuffer, - flowSize: Int + flowSize: Int, ): Result = ??? override def onPriorityFrame(streamId: Int, priority: Priority.Dependent): Result = ??? override def onWindowUpdateFrame(streamId: Int, sizeIncrement: Int): Result = ??? diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/ObservingSessionFlowControl.scala b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/ObservingSessionFlowControl.scala index 363ee4fa7..7e3a0ba75 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/ObservingSessionFlowControl.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/ObservingSessionFlowControl.scala @@ -23,7 +23,7 @@ private[http2] class ObservingSessionFlowControl( session: SessionCore ) extends SessionFlowControlImpl( session = session, - flowStrategy = null /* only used on two overridden methods */ + flowStrategy = null, /* only used on two overridden methods */ ) { override protected def onSessonBytesConsumed(consumed: Int): Unit = () override protected def onStreamBytesConsumed(stream: StreamFlowWindow, consumed: Int): Unit = () diff --git a/http/src/test/scala/org/http4s/blaze/http/parser/BenchParser.scala b/http/src/test/scala/org/http4s/blaze/http/parser/BenchParser.scala index 569ad7e26..f4be61386 100644 --- a/http/src/test/scala/org/http4s/blaze/http/parser/BenchParser.scala +++ b/http/src/test/scala/org/http4s/blaze/http/parser/BenchParser.scala @@ -34,7 +34,7 @@ class BenchParser(maxReq: Int = 1034, maxHeader: Int = 1024) uri: String, scheme: String, majorversion: Int, - minorversion: Int + minorversion: Int, ): Boolean = false def headerComplete(name: String, value: String) = false diff --git a/http/src/test/scala/org/http4s/blaze/http/parser/ClientParserSuite.scala b/http/src/test/scala/org/http4s/blaze/http/parser/ClientParserSuite.scala index dcf200aa4..ed21bc791 100644 --- a/http/src/test/scala/org/http4s/blaze/http/parser/ClientParserSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/parser/ClientParserSuite.scala @@ -61,7 +61,7 @@ class ClientParserSuite extends BlazeTestSuite { reason: String, scheme: String, majorversion: Int, - minorversion: Int + minorversion: Int, ): Unit = { this.code = code this.reason = reason diff --git a/http/src/test/scala/org/http4s/blaze/http/parser/ResponseParser.scala b/http/src/test/scala/org/http4s/blaze/http/parser/ResponseParser.scala index 257029500..85aeaca6d 100644 --- a/http/src/test/scala/org/http4s/blaze/http/parser/ResponseParser.scala +++ b/http/src/test/scala/org/http4s/blaze/http/parser/ResponseParser.scala @@ -75,7 +75,7 @@ class ResponseParser extends Http1ClientParser { reason: String, scheme: String, majorversion: Int, - minorversion: Int + minorversion: Int, ): Unit = { this.code = code this.reason = reason diff --git a/http/src/test/scala/org/http4s/blaze/http/parser/ServerParserSuite.scala b/http/src/test/scala/org/http4s/blaze/http/parser/ServerParserSuite.scala index dbc711918..74c66b790 100644 --- a/http/src/test/scala/org/http4s/blaze/http/parser/ServerParserSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/parser/ServerParserSuite.scala @@ -56,7 +56,7 @@ class ServerParserSuite extends BlazeTestSuite { uri: String, scheme: String, majorversion: Int, - minorversion: Int + minorversion: Int, ) = { // println(s"$methodString, $uri, $scheme/$majorversion.$minorversion") minorv = minorversion @@ -231,7 +231,7 @@ class ServerParserSuite extends BlazeTestSuite { assert(p.parseheaders(hsStr)) assertEquals( p.getContentType, - EndOfContent.END + EndOfContent.END, ) // since the headers didn't indicate any content assertEquals(p.h.result(), List.fill(4)(("If-Modified-Since", ""))) } From fd0f6a8a2c040dce5e3425020b1eba062d9878b9 Mon Sep 17 00:00:00 2001 From: "http4s-steward[bot]" <106843772+http4s-steward[bot]@users.noreply.github.com> Date: Tue, 1 Nov 2022 02:37:05 +0000 Subject: [PATCH 3/4] Add 'Reformat with scalafmt 3.6.1' to .git-blame-ignore-revs --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index e2dc0b5b5..d2526d3a4 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,5 @@ # Scala Steward: Reformat with sbt-java-formatter 0.8.0 5530966ad87bd0411fb7bc520632eb5868a2bb4b + +# Scala Steward: Reformat with scalafmt 3.6.1 +7c66b82deb1c0c64e8b3360c34cd52145ceaeab5 From 028785b7881bba4c72dc3cdabf640e772238cc07 Mon Sep 17 00:00:00 2001 From: danicheg Date: Sun, 4 Dec 2022 11:10:26 +0300 Subject: [PATCH 4/4] Scalafmt --- .../http4s/blaze/channel/ChannelHead.scala | 2 +- .../channel/nio1/FixedSelectorPool.scala | 2 +- .../channel/nio1/NIO1ClientChannel.scala | 2 +- .../blaze/channel/nio1/NIO1HeadStage.scala | 4 +- .../channel/nio1/NIO1SocketServerGroup.scala | 20 ++-- .../blaze/channel/nio1/SelectorLoop.scala | 4 +- .../blaze/channel/nio2/ByteBufferHead.scala | 4 +- .../channel/nio2/ClientChannelFactory.scala | 6 +- .../blaze/pipeline/PipelineBuilder.scala | 2 +- .../blaze/pipeline/stages/SSLStage.scala | 2 +- .../monitors/IntervalConnectionMonitor.scala | 8 +- .../scala/org/http4s/blaze/util/Actor.scala | 2 +- .../org/http4s/blaze/util/BufferTools.scala | 6 +- .../http4s/blaze/util/TickWheelExecutor.scala | 2 +- .../blaze/channel/ChannelOptionsSuite.scala | 6 +- .../blaze/pipeline/stages/DelayHead.scala | 4 +- .../blaze/pipeline/stages/SSLStageSuite.scala | 7 +- .../org/http4s/blaze/util/ActorSuite.scala | 5 +- .../http4s/blaze/util/BufferToolsSuite.scala | 6 +- .../http4s/blaze/util/TaskQueueSuite.scala | 2 +- .../blaze/util/TickWheelExecutorSuite.scala | 4 +- .../com/example/http4s/ExampleService.scala | 2 +- .../com/example/http4s/HeaderExamples.scala | 6 +- .../blaze/ClientMultipartPostExample.scala | 4 +- .../blaze/demo/client/MultipartClient.scala | 2 +- .../http4s/blaze/demo/server/Server.scala | 2 +- .../main/scala/com/example/http4s/ssl.scala | 4 +- .../org/http4s/blaze/http/HttpRequest.scala | 2 +- .../blaze/http/http2/ConnectionImpl.scala | 8 +- .../http/http2/DefaultFlowStrategy.scala | 4 +- .../blaze/http/http2/FrameDecoder.scala | 6 +- .../blaze/http/http2/FrameEncoder.scala | 6 +- .../blaze/http/http2/FrameListener.scala | 4 +- .../blaze/http/http2/FrameSerializer.scala | 14 +-- .../HeaderAggregatingFrameListener.scala | 12 +- .../blaze/http/http2/HeaderDecoder.scala | 4 +- .../blaze/http/http2/Http2Settings.scala | 10 +- .../http/http2/InboundStreamStateImpl.scala | 2 +- .../http4s/blaze/http/http2/PingManager.scala | 6 +- .../http/http2/SessionFlowControlImpl.scala | 2 +- .../http/http2/SessionFrameListener.scala | 6 +- .../blaze/http/http2/SettingsDecoder.scala | 2 +- .../blaze/http/http2/StreamIdManager.scala | 2 +- .../blaze/http/http2/StreamManagerImpl.scala | 2 +- .../blaze/http/http2/StreamStateImpl.scala | 4 +- .../http/http2/WriteControllerImpl.scala | 4 +- .../http2/server/ALPNServerSelector.scala | 2 +- .../ServerPriorKnowledgeHandshaker.scala | 8 +- .../http4s/blaze/http/util/HeaderTools.scala | 4 +- .../http4s/blaze/http/BodyReaderSuite.scala | 2 +- .../http/http2/ConnectionImplSuite.scala | 2 +- .../blaze/http/http2/FrameDecoderSuite.scala | 104 +++++++++--------- .../blaze/http/http2/FrameEncoderSuite.scala | 10 +- .../http/http2/FrameSerializerSuite.scala | 24 ++-- .../HeaderAggregatingFrameListenerSuite.scala | 8 +- .../blaze/http/http2/HeaderDecoderSuite.scala | 4 +- .../blaze/http/http2/HeaderEncoderSuite.scala | 2 +- .../http/http2/ProtocolFrameDecoder.scala | 2 +- .../ServerPriorKnowledgeHandshakerSuite.scala | 2 +- .../http/http2/SessionFlowControlSuite.scala | 4 +- .../http2/SessionFrameListenerSuite.scala | 12 +- .../http/http2/StreamFlowWindowSuite.scala | 4 +- .../http/http2/StreamStateImplSuite.scala | 10 +- .../http/http2/mocks/MockFrameListener.scala | 6 +- .../MockHeaderAggregatingFrameListener.scala | 8 +- .../mocks/ObservingSessionFlowControl.scala | 2 +- .../blaze/http/parser/BenchParser.scala | 2 +- .../blaze/http/parser/ClientParserSuite.scala | 2 +- .../blaze/http/parser/ResponseParser.scala | 2 +- .../blaze/http/parser/ServerParserSuite.scala | 4 +- 70 files changed, 222 insertions(+), 228 deletions(-) diff --git a/core/src/main/scala/org/http4s/blaze/channel/ChannelHead.scala b/core/src/main/scala/org/http4s/blaze/channel/ChannelHead.scala index 25f4a5323..70fb566f8 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/ChannelHead.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/ChannelHead.scala @@ -47,6 +47,6 @@ object ChannelHead { "Connection reset", // Found on Linux, Java 13 "An existing connection was forcibly closed by the remote host", // Found on Windows "Broken pipe", // also found on Linux - "The specified network name is no longer available.\r\n", // Found on Windows NIO2 + "The specified network name is no longer available.\r\n" // Found on Windows NIO2 ) } diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala index 635877f5c..c04f68abd 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala @@ -26,7 +26,7 @@ import scala.annotation.tailrec final class FixedSelectorPool( poolSize: Int, bufferSize: Int, - threadFactory: ThreadFactory, + threadFactory: ThreadFactory ) extends SelectorLoopPool { require(poolSize > 0, s"Invalid pool size: $poolSize") diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1ClientChannel.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1ClientChannel.scala index 96f032a67..262baf5dc 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1ClientChannel.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1ClientChannel.scala @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean private[blaze] final class NIO1ClientChannel( private[this] val underlying: SocketChannel, - private[this] val onClose: () => Unit, + private[this] val onClose: () => Unit ) extends NIO1Channel { private[this] val closed = new AtomicBoolean(false) diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1HeadStage.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1HeadStage.scala index e2d692e4d..87d042bc1 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1HeadStage.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1HeadStage.scala @@ -72,7 +72,7 @@ private[nio1] object NIO1HeadStage { private def performWrite( ch: NIO1ClientChannel, scratch: ByteBuffer, - buffers: Array[ByteBuffer], + buffers: Array[ByteBuffer] ): WriteResult = try if (BufferTools.areDirectOrEmpty(buffers)) { @@ -122,7 +122,7 @@ private[nio1] object NIO1HeadStage { private[nio1] final class NIO1HeadStage( ch: NIO1ClientChannel, selectorLoop: SelectorLoop, - key: SelectionKey, + key: SelectionKey ) extends ChannelHead with Selectable { import NIO1HeadStage._ diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1SocketServerGroup.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1SocketServerGroup.scala index b057d5a63..8978b6904 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1SocketServerGroup.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/NIO1SocketServerGroup.scala @@ -28,7 +28,7 @@ import org.http4s.blaze.channel.{ DefaultPoolSize, ServerChannel, ServerChannelGroup, - SocketPipelineBuilder, + SocketPipelineBuilder } import org.http4s.blaze.pipeline.Command import org.http4s.blaze.util.{BasicThreadFactory, Connections} @@ -67,7 +67,7 @@ object NIO1SocketServerGroup { acceptorPool: SelectorLoopPool, workerPool: SelectorLoopPool, channelOptions: ChannelOptions = ChannelOptions.DefaultOptions, - maxConnections: Int = DefaultMaxConnections, + maxConnections: Int = DefaultMaxConnections ): ServerChannelGroup = new NIO1SocketServerGroup(acceptorPool, workerPool, channelOptions, maxConnections) @@ -82,7 +82,7 @@ object NIO1SocketServerGroup { selectorThreadFactory: ThreadFactory = defaultWorkerThreadFactory, acceptorThreads: Int = 1, acceptorThreadFactory: ThreadFactory = defaultAcceptorThreadFactory, - maxConnections: Int = DefaultMaxConnections, + maxConnections: Int = DefaultMaxConnections ): ServerChannelGroup = { val acceptorPool = new FixedSelectorPool(acceptorThreads, 1, acceptorThreadFactory) val workerPool = new FixedSelectorPool(workerThreads, bufferSize, selectorThreadFactory) @@ -104,7 +104,7 @@ object NIO1SocketServerGroup { override def bind( address: InetSocketAddress, - service: SocketPipelineBuilder, + service: SocketPipelineBuilder ): Try[ServerChannel] = underlying.bind(address, service) } @@ -122,7 +122,7 @@ private final class NIO1SocketServerGroup private ( acceptorPool: SelectorLoopPool, workerPool: SelectorLoopPool, channelOptions: ChannelOptions, - maxConnections: Int, + maxConnections: Int ) extends ServerChannelGroup { private[this] val logger = getLogger // Also acts as our intrinsic lock. @@ -140,7 +140,7 @@ private final class NIO1SocketServerGroup private ( private[this] class SocketAcceptor( key: SelectionKey, ch: ServerChannelImpl, - service: SocketPipelineBuilder, + service: SocketPipelineBuilder ) extends Selectable { // Save it since once the channel is closed, we're in trouble. private[this] val closed = new AtomicBoolean(false) @@ -192,7 +192,7 @@ private final class NIO1SocketServerGroup private ( // minimize race conditions. private[this] final class ServerChannelImpl( val selectableChannel: ServerSocketChannel, - selectorLoop: SelectorLoop, + selectorLoop: SelectorLoop ) extends ServerChannel with NIO1Channel { @volatile @@ -252,7 +252,7 @@ private final class NIO1SocketServerGroup private ( */ override def bind( address: InetSocketAddress, - service: SocketPipelineBuilder, + service: SocketPipelineBuilder ): Try[ServerChannel] = Try { val ch = ServerSocketChannel.open().bind(address) @@ -283,7 +283,7 @@ private final class NIO1SocketServerGroup private ( // Will be called from within the SelectorLoop private[this] def buildSocketAcceptor( ch: ServerChannelImpl, - service: SocketPipelineBuilder, + service: SocketPipelineBuilder )(key: SelectionKey): Selectable = { val acceptor = new SocketAcceptor(key, ch, service) try key.interestOps(SelectionKey.OP_ACCEPT) @@ -295,7 +295,7 @@ private final class NIO1SocketServerGroup private ( private[this] def handleClientChannel( clientChannel: NIO1ClientChannel, - service: SocketPipelineBuilder, + service: SocketPipelineBuilder ): Unit = try { clientChannel.configureBlocking(false) diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio1/SelectorLoop.scala b/core/src/main/scala/org/http4s/blaze/channel/nio1/SelectorLoop.scala index 2876f3716..64227e3bb 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio1/SelectorLoop.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio1/SelectorLoop.scala @@ -47,7 +47,7 @@ import scala.util.control.{ControlThrowable, NonFatal} final class SelectorLoop( selector: Selector, bufferSize: Int, - threadFactory: ThreadFactory, + threadFactory: ThreadFactory ) extends Executor with ExecutionContext { require(bufferSize > 0, s"Invalid buffer size: $bufferSize") @@ -126,7 +126,7 @@ final class SelectorLoop( */ def initChannel( ch: NIO1Channel, - mkStage: SelectionKey => Selectable, + mkStage: SelectionKey => Selectable ): Unit = enqueueTask(new Runnable { override def run(): Unit = diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio2/ByteBufferHead.scala b/core/src/main/scala/org/http4s/blaze/channel/nio2/ByteBufferHead.scala index 5bee5c785..ee5a46397 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio2/ByteBufferHead.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio2/ByteBufferHead.scala @@ -68,7 +68,7 @@ private[nio2] final class ByteBufferHead(channel: AsynchronousSocketChannel, buf p.success(()) () } - }, + } ) go(0) @@ -107,7 +107,7 @@ private[nio2] final class ByteBufferHead(channel: AsynchronousSocketChannel, buf p.success(BufferTools.copyBuffer(scratchBuffer)) () } - }, + } ) p.future } diff --git a/core/src/main/scala/org/http4s/blaze/channel/nio2/ClientChannelFactory.scala b/core/src/main/scala/org/http4s/blaze/channel/nio2/ClientChannelFactory.scala index 05b6cbd0f..e10acbfc2 100644 --- a/core/src/main/scala/org/http4s/blaze/channel/nio2/ClientChannelFactory.scala +++ b/core/src/main/scala/org/http4s/blaze/channel/nio2/ClientChannelFactory.scala @@ -44,7 +44,7 @@ final class ClientChannelFactory( group: Option[AsynchronousChannelGroup] = None, channelOptions: ChannelOptions = ChannelOptions.DefaultOptions, scheduler: TickWheelExecutor = Execution.scheduler, - connectTimeout: Duration = Duration.Inf, + connectTimeout: Duration = Duration.Inf ) { private[this] val logger = getLogger @@ -52,13 +52,13 @@ final class ClientChannelFactory( def this( bufferSize: Int, group: Option[AsynchronousChannelGroup], - channelOptions: ChannelOptions, + channelOptions: ChannelOptions ) = this(bufferSize, group, channelOptions, Execution.scheduler, Duration.Inf) def connect( remoteAddress: SocketAddress, - bufferSize: Int = bufferSize, + bufferSize: Int = bufferSize ): Future[HeadStage[ByteBuffer]] = { val p = Promise[HeadStage[ByteBuffer]]() diff --git a/core/src/main/scala/org/http4s/blaze/pipeline/PipelineBuilder.scala b/core/src/main/scala/org/http4s/blaze/pipeline/PipelineBuilder.scala index 354ff8f8f..abe9138a8 100644 --- a/core/src/main/scala/org/http4s/blaze/pipeline/PipelineBuilder.scala +++ b/core/src/main/scala/org/http4s/blaze/pipeline/PipelineBuilder.scala @@ -56,7 +56,7 @@ object LeafBuilder { */ final class TrunkBuilder[I1, O] private[pipeline] ( protected val head: MidStage[I1, _], - protected val tail: MidStage[_, O], + protected val tail: MidStage[_, O] ) { def append[N](stage: MidStage[O, N]): TrunkBuilder[I1, N] = { if (stage._prevStage != null) sys.error(s"Stage $stage must be fresh") diff --git a/core/src/main/scala/org/http4s/blaze/pipeline/stages/SSLStage.scala b/core/src/main/scala/org/http4s/blaze/pipeline/stages/SSLStage.scala index 06427cbd4..1acf851b6 100644 --- a/core/src/main/scala/org/http4s/blaze/pipeline/stages/SSLStage.scala +++ b/core/src/main/scala/org/http4s/blaze/pipeline/stages/SSLStage.scala @@ -32,7 +32,7 @@ import org.http4s.blaze.util.{ BufferTools, Execution, SerialExecutionContext, - ThreadLocalScratchBuffer, + ThreadLocalScratchBuffer } import org.http4s.blaze.util.BufferTools._ diff --git a/core/src/main/scala/org/http4s/blaze/pipeline/stages/monitors/IntervalConnectionMonitor.scala b/core/src/main/scala/org/http4s/blaze/pipeline/stages/monitors/IntervalConnectionMonitor.scala index 889c4e2c3..a7b2052d2 100644 --- a/core/src/main/scala/org/http4s/blaze/pipeline/stages/monitors/IntervalConnectionMonitor.scala +++ b/core/src/main/scala/org/http4s/blaze/pipeline/stages/monitors/IntervalConnectionMonitor.scala @@ -21,7 +21,7 @@ import scala.concurrent.duration.Duration class IntervalConnectionMonitor(val interval: Duration) extends ConnectionMonitor { require( interval.isFinite && interval.toNanos > 1, - "Duration must be Finite and greater than 1 ns", + "Duration must be Finite and greater than 1 ns" ) private val alpha = 1.0 / (interval.toNanos + 1).toDouble @@ -75,7 +75,7 @@ class IntervalConnectionMonitor(val interval: Duration) extends ConnectionMonito ototal: Long, connmean: Double, conntotal: Long, - connlive: Long, + connlive: Long ) { override def toString: String = { val mb = (1024 * 1024).toDouble @@ -101,7 +101,7 @@ class IntervalConnectionMonitor(val interval: Duration) extends ConnectionMonito ototal / f2, connmean, conntotal, - connlive, + connlive ) } } @@ -115,7 +115,7 @@ class IntervalConnectionMonitor(val interval: Duration) extends ConnectionMonito outbound.getTotal(), conns.getMean(), conns.getTotal(), - conns.getLive(), + conns.getLive() ) })) diff --git a/core/src/main/scala/org/http4s/blaze/util/Actor.scala b/core/src/main/scala/org/http4s/blaze/util/Actor.scala index 01a174de4..50eec94bf 100644 --- a/core/src/main/scala/org/http4s/blaze/util/Actor.scala +++ b/core/src/main/scala/org/http4s/blaze/util/Actor.scala @@ -29,7 +29,7 @@ import org.http4s.blaze.util.Actor.DefaultMaxIterations */ private[blaze] abstract class Actor[M]( ec: ExecutionContext, - maxTasksBeforeReschedule: Int = DefaultMaxIterations, + maxTasksBeforeReschedule: Int = DefaultMaxIterations ) { require(maxTasksBeforeReschedule > 0) diff --git a/core/src/main/scala/org/http4s/blaze/util/BufferTools.scala b/core/src/main/scala/org/http4s/blaze/util/BufferTools.scala index 2f078978e..7a0dc3f9d 100644 --- a/core/src/main/scala/org/http4s/blaze/util/BufferTools.scala +++ b/core/src/main/scala/org/http4s/blaze/util/BufferTools.scala @@ -78,10 +78,8 @@ object BufferTools { oldbuff // already established that oldbuff is not `null` else if (!oldbuff.hasRemaining) newbuff else if (!newbuff.hasRemaining) oldbuff - else if ( - !oldbuff.isReadOnly && oldbuff - .capacity() >= oldbuff.limit() + newbuff.remaining() - ) { + else if (!oldbuff.isReadOnly && oldbuff + .capacity() >= oldbuff.limit() + newbuff.remaining()) { // Enough room to append newbuff to the end tof oldbuff oldbuff .mark() diff --git a/core/src/main/scala/org/http4s/blaze/util/TickWheelExecutor.scala b/core/src/main/scala/org/http4s/blaze/util/TickWheelExecutor.scala index 8fe135e9f..55c1fc649 100644 --- a/core/src/main/scala/org/http4s/blaze/util/TickWheelExecutor.scala +++ b/core/src/main/scala/org/http4s/blaze/util/TickWheelExecutor.scala @@ -243,7 +243,7 @@ class TickWheelExecutor(wheelSize: Int = DefaultWheelSize, val tick: Duration = val expiration: Long, var prev: Node, var next: Node, - var canceled: Boolean = false, + var canceled: Boolean = false ) extends Cancelable { /** Remove this node from its linked list */ diff --git a/core/src/test/scala/org/http4s/blaze/channel/ChannelOptionsSuite.scala b/core/src/test/scala/org/http4s/blaze/channel/ChannelOptionsSuite.scala index 666213f38..f8e0dd840 100644 --- a/core/src/test/scala/org/http4s/blaze/channel/ChannelOptionsSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/channel/ChannelOptionsSuite.scala @@ -26,7 +26,7 @@ class ChannelOptionsSuite extends FunSuite { test("A ChannelOptions should be set on a NetworkChannel") { val options = ChannelOptions( OptionValue[java.lang.Boolean](java.net.StandardSocketOptions.TCP_NODELAY, true), - OptionValue[java.lang.Boolean](java.net.StandardSocketOptions.SO_KEEPALIVE, false), + OptionValue[java.lang.Boolean](java.net.StandardSocketOptions.SO_KEEPALIVE, false) ) val ch = new NetworkChannel { @@ -62,11 +62,11 @@ class ChannelOptionsSuite extends FunSuite { assertEquals( ch.getOption[java.lang.Boolean](java.net.StandardSocketOptions.TCP_NODELAY), - java.lang.Boolean.TRUE, + java.lang.Boolean.TRUE ) assertEquals( ch.getOption[java.lang.Boolean](java.net.StandardSocketOptions.SO_KEEPALIVE), - java.lang.Boolean.FALSE, + java.lang.Boolean.FALSE ) } } diff --git a/core/src/test/scala/org/http4s/blaze/pipeline/stages/DelayHead.scala b/core/src/test/scala/org/http4s/blaze/pipeline/stages/DelayHead.scala index 277f38b3e..f42b87c63 100644 --- a/core/src/test/scala/org/http4s/blaze/pipeline/stages/DelayHead.scala +++ b/core/src/test/scala/org/http4s/blaze/pipeline/stages/DelayHead.scala @@ -63,7 +63,7 @@ abstract class DelayHead[I](delay: Duration) extends HeadStage[I] { } }, delay.toNanos, - TimeUnit.NANOSECONDS, + TimeUnit.NANOSECONDS ) p.future } @@ -78,7 +78,7 @@ abstract class DelayHead[I](delay: Duration) extends HeadStage[I] { } }, delay.toNanos, - TimeUnit.NANOSECONDS, + TimeUnit.NANOSECONDS ) rememberPromise(p) diff --git a/core/src/test/scala/org/http4s/blaze/pipeline/stages/SSLStageSuite.scala b/core/src/test/scala/org/http4s/blaze/pipeline/stages/SSLStageSuite.scala index c5009d90c..ace6c91d9 100644 --- a/core/src/test/scala/org/http4s/blaze/pipeline/stages/SSLStageSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/pipeline/stages/SSLStageSuite.scala @@ -42,7 +42,7 @@ class SSLStageSuite extends BlazeTestSuite { // The battery of tests for both client and server private def testBattery( testSuitePrefix: String, - mkClientServerEngines: => (SSLEngine, SSLEngine), + mkClientServerEngines: => (SSLEngine, SSLEngine) ) = { test(testSuitePrefix + " should transcode a single buffer") { val (headEng, stageEng) = mkClientServerEngines @@ -95,9 +95,8 @@ class SSLStageSuite extends BlazeTestSuite { r <- Future(BufferTools.mkString(head.results)) h <- Future(head.multipleWrite) } yield r -> h, - s + s -> false, - ) - ) + s + s -> false + )) } test(testSuitePrefix + " should transcode multiple single byte buffers") { diff --git a/core/src/test/scala/org/http4s/blaze/util/ActorSuite.scala b/core/src/test/scala/org/http4s/blaze/util/ActorSuite.scala index 1b9c9b9d6..f0fea7d78 100644 --- a/core/src/test/scala/org/http4s/blaze/util/ActorSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/util/ActorSuite.scala @@ -57,14 +57,13 @@ class ActorSuite extends FunSuite { flag.set(t) latch.countDown() }, - global, + global ) for (_ <- 0 until senders) global.execute(() => for (_ <- 0 until messages) - a ! Continuation(_ => latch.countDown()) - ) + a ! Continuation(_ => latch.countDown())) assert(latch.await(15, TimeUnit.SECONDS)) diff --git a/core/src/test/scala/org/http4s/blaze/util/BufferToolsSuite.scala b/core/src/test/scala/org/http4s/blaze/util/BufferToolsSuite.scala index 41d9b78c8..6b2e8a6b7 100644 --- a/core/src/test/scala/org/http4s/blaze/util/BufferToolsSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/util/BufferToolsSuite.scala @@ -119,7 +119,7 @@ class BufferToolsSuite extends FunSuite { _ => fail( "BufferTools.takeSlice should throw an `IllegalArgumentException` if you try to slice too many bytes" - ), + ) ) } @@ -140,14 +140,14 @@ class BufferToolsSuite extends FunSuite { _ => fail( "BufferTools.takeSlice should throw an `IllegalArgumentException` if you try to slice negative bytes" - ), + ) ) } test("BufferTools.checkEmpty should check if buffers are empty") { assertEquals( BufferTools.checkEmpty(Array(ByteBuffer.allocate(0), ByteBuffer.allocate(3))), - false, + false ) assertEquals(BufferTools.checkEmpty(Seq(ByteBuffer.allocate(0), ByteBuffer.allocate(3))), false) diff --git a/core/src/test/scala/org/http4s/blaze/util/TaskQueueSuite.scala b/core/src/test/scala/org/http4s/blaze/util/TaskQueueSuite.scala index ce9fd1a56..93435959f 100644 --- a/core/src/test/scala/org/http4s/blaze/util/TaskQueueSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/util/TaskQueueSuite.scala @@ -107,7 +107,7 @@ class TaskQueueSuite extends FunSuite { counter.incrementAndGet() () }, - TaskQueue.Enqueued, + TaskQueue.Enqueued ) sleepLatch.countDown() diff --git a/core/src/test/scala/org/http4s/blaze/util/TickWheelExecutorSuite.scala b/core/src/test/scala/org/http4s/blaze/util/TickWheelExecutorSuite.scala index 12d163f30..fa2df8ca9 100644 --- a/core/src/test/scala/org/http4s/blaze/util/TickWheelExecutorSuite.scala +++ b/core/src/test/scala/org/http4s/blaze/util/TickWheelExecutorSuite.scala @@ -118,7 +118,7 @@ class TickWheelExecutorSuite extends FunSuite { case _: RuntimeException => () case ex => fail(s"Unexpected exception found $ex") }, - _ => fail("A TickWheelExecutor should shutdown"), + _ => fail("A TickWheelExecutor should shutdown") ) val result2 = Try(ec.schedule(() => sys.error("Woops!"), Duration.Inf)) @@ -128,7 +128,7 @@ class TickWheelExecutorSuite extends FunSuite { case _: RuntimeException => () case ex => fail(s"Unexpected exception found $ex") }, - _ => fail("A TickWheelExecutor should shutdown"), + _ => fail("A TickWheelExecutor should shutdown") ) } } diff --git a/examples/src/main/scala/com/example/http4s/ExampleService.scala b/examples/src/main/scala/com/example/http4s/ExampleService.scala index c9e3914d6..e7476b6de 100644 --- a/examples/src/main/scala/com/example/http4s/ExampleService.scala +++ b/examples/src/main/scala/com/example/http4s/ExampleService.scala @@ -38,7 +38,7 @@ class ExampleService[F[_]](implicit F: Async[F]) extends Http4sDsl[F] { def routes: HttpRoutes[F] = Router[F]( "" -> rootRoutes, - "/auth" -> authRoutes, + "/auth" -> authRoutes ) def rootRoutes: HttpRoutes[F] = diff --git a/examples/src/main/scala/com/example/http4s/HeaderExamples.scala b/examples/src/main/scala/com/example/http4s/HeaderExamples.scala index a937d1de4..84b3b46a4 100644 --- a/examples/src/main/scala/com/example/http4s/HeaderExamples.scala +++ b/examples/src/main/scala/com/example/http4s/HeaderExamples.scala @@ -40,7 +40,7 @@ object HeaderExamples { val myHeaders: Headers = Headers( Foo("hello"), "my" -> "header", - baz, + baz ) // //// test for selection final case class Bar(v: NonEmptyList[String]) @@ -73,7 +73,7 @@ object HeaderExamples { Foo("two"), SetCookie("cookie1", "a cookie"), Bar(NonEmptyList.one("three")), - SetCookie("cookie2", "another cookie"), + SetCookie("cookie2", "another cookie") ) val a: Option[Foo] = hs.get[Foo] @@ -98,7 +98,7 @@ object HeaderExamples { "a" -> "b", Option("a" -> "c"), List("a" -> "c"), - List(SetCookie("cookie3", "cookie three")), + List(SetCookie("cookie3", "cookie three")) // , // Option(List("a" -> "c")) // correctly fails to compile ) diff --git a/examples/src/main/scala/com/example/http4s/blaze/ClientMultipartPostExample.scala b/examples/src/main/scala/com/example/http4s/blaze/ClientMultipartPostExample.scala index 24eed849d..48d79c4b1 100644 --- a/examples/src/main/scala/com/example/http4s/blaze/ClientMultipartPostExample.scala +++ b/examples/src/main/scala/com/example/http4s/blaze/ClientMultipartPostExample.scala @@ -37,14 +37,14 @@ object ClientMultipartPostExample extends IOApp with Http4sClientDsl[IO] { val url = Uri( scheme = Some(Scheme.http), authority = Some(Authority(host = RegName("httpbin.org"))), - path = path"/post", + path = path"/post" ) multiparts .multipart( Vector( Part.formData("text", "This is text."), - Part.fileData("BALL", bottle, `Content-Type`(MediaType.image.png)), + Part.fileData("BALL", bottle, `Content-Type`(MediaType.image.png)) ) ) .flatMap { multipart => diff --git a/examples/src/main/scala/com/example/http4s/blaze/demo/client/MultipartClient.scala b/examples/src/main/scala/com/example/http4s/blaze/demo/client/MultipartClient.scala index 5cb889287..1d52f0474 100644 --- a/examples/src/main/scala/com/example/http4s/blaze/demo/client/MultipartClient.scala +++ b/examples/src/main/scala/com/example/http4s/blaze/demo/client/MultipartClient.scala @@ -45,7 +45,7 @@ class MultipartHttpClient(implicit S: StreamUtils[IO]) extends IOApp with Http4s body <- multiparts.multipart( Vector( Part.formData("name", "gvolpe"), - Part.fileData("rick", url, `Content-Type`(MediaType.image.png)), + Part.fileData("rick", url, `Content-Type`(MediaType.image.png)) ) ) } yield POST(body, uri"http://localhost:8080/v1/multipart").withHeaders(body.headers) diff --git a/examples/src/main/scala/com/example/http4s/blaze/demo/server/Server.scala b/examples/src/main/scala/com/example/http4s/blaze/demo/server/Server.scala index 76517ea3c..5790991c4 100644 --- a/examples/src/main/scala/com/example/http4s/blaze/demo/server/Server.scala +++ b/examples/src/main/scala/com/example/http4s/blaze/demo/server/Server.scala @@ -34,7 +34,7 @@ object HttpServer { s"/${endpoints.ApiVersion}/protected" -> ctx.basicAuthHttpEndpoint, s"/${endpoints.ApiVersion}" -> ctx.fileHttpEndpoint, s"/${endpoints.ApiVersion}/nonstream" -> ctx.nonStreamFileHttpEndpoint, - "/" -> ctx.httpServices, + "/" -> ctx.httpServices ).orNotFound def stream[F[_]: Async]: Stream[F, ExitCode] = diff --git a/examples/src/main/scala/com/example/http4s/ssl.scala b/examples/src/main/scala/com/example/http4s/ssl.scala index 3d56a5a43..e195e2993 100644 --- a/examples/src/main/scala/com/example/http4s/ssl.scala +++ b/examples/src/main/scala/com/example/http4s/ssl.scala @@ -76,9 +76,9 @@ object ssl { Authority( userInfo = request.uri.authority.flatMap(_.userInfo), host = RegName(host), - port = securePort.some, + port = securePort.some ) - ), + ) ) MovedPermanently(Location(baseUri.withPath(request.uri.path))) case _ => diff --git a/http/src/main/scala/org/http4s/blaze/http/HttpRequest.scala b/http/src/main/scala/org/http4s/blaze/http/HttpRequest.scala index 04961abfb..834a5aff5 100644 --- a/http/src/main/scala/org/http4s/blaze/http/HttpRequest.scala +++ b/http/src/main/scala/org/http4s/blaze/http/HttpRequest.scala @@ -34,7 +34,7 @@ case class HttpRequest( majorVersion: Int, minorVersion: Int, headers: Headers, - body: BodyReader, + body: BodyReader ) { private[this] def formatStr(headersString: String): String = s"HttpRequest($method, $url, $majorVersion, $minorVersion, $headersString, $body)" diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/ConnectionImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/ConnectionImpl.scala index 8517e025e..c1882a52d 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/ConnectionImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/ConnectionImpl.scala @@ -41,7 +41,7 @@ private final class ConnectionImpl( val remoteSettings: MutableHttp2Settings, flowStrategy: FlowStrategy, inboundStreamBuilder: Option[Int => LeafBuilder[StreamFrame]], - parentExecutor: ExecutionContext, + parentExecutor: ExecutionContext ) extends SessionCore with Connection { // Shortcut methods @@ -57,9 +57,9 @@ private final class ConnectionImpl( new HeaderDecoder( maxHeaderListSize = localSettings.maxHeaderListSize, discardOverflowHeaders = true, - maxTableSize = localSettings.headerTableSize, - ), - ), + maxTableSize = localSettings.headerTableSize + ) + ) ) @volatile diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/DefaultFlowStrategy.scala b/http/src/main/scala/org/http4s/blaze/http/http2/DefaultFlowStrategy.scala index be5398dba..a30954015 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/DefaultFlowStrategy.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/DefaultFlowStrategy.scala @@ -23,7 +23,7 @@ final class DefaultFlowStrategy(localSettings: Http2Settings) extends FlowStrate check( localSettings.initialWindowSize, session.sessionInboundWindow, - session.sessionUnconsumedBytes, + session.sessionUnconsumedBytes ) override def checkStream(stream: StreamFlowWindow): Increment = { @@ -31,7 +31,7 @@ final class DefaultFlowStrategy(localSettings: Http2Settings) extends FlowStrate val streamAck = check( localSettings.initialWindowSize, stream.streamInboundWindow, - stream.streamUnconsumedBytes, + stream.streamUnconsumedBytes ) FlowStrategy.increment(sessionAck, streamAck) diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala b/http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala index 57c92cbba..46cd8a3c3 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/FrameDecoder.scala @@ -174,7 +174,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener priority, Flags.END_HEADERS(flags), Flags.END_STREAM(flags), - buffer.slice(), + buffer.slice() ) } } @@ -243,7 +243,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener streamId, promisedId, Flags.END_HEADERS(flags), - buffer.slice(), + buffer.slice() ) } } @@ -301,7 +301,7 @@ private class FrameDecoder(localSettings: Http2Settings, listener: FrameListener private[this] def decodeContinuationFrame( buffer: ByteBuffer, streamId: Int, - flags: Byte, + flags: Byte ): Result = if (streamId == 0) { val msg = "CONTINUATION frame with invalid stream dependency on 0x0" diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/FrameEncoder.scala b/http/src/main/scala/org/http4s/blaze/http/http2/FrameEncoder.scala index bc526bacd..1a0413c48 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/FrameEncoder.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/FrameEncoder.scala @@ -81,7 +81,7 @@ private final class FrameEncoder(remoteSettings: Http2Settings, headerEncoder: H streamId: Int, priority: Priority, endStream: Boolean, - headers: Headers, + headers: Headers ): collection.Seq[ByteBuffer] = { val rawHeaders = headerEncoder.encodeHeaders(headers) @@ -96,7 +96,7 @@ private final class FrameEncoder(remoteSettings: Http2Settings, headerEncoder: H endHeaders = true, endStream, padding = 0, - rawHeaders, + rawHeaders ) else { // need to fragment @@ -110,7 +110,7 @@ private final class FrameEncoder(remoteSettings: Http2Settings, headerEncoder: H endHeaders = false, endStream, padding = 0, - headersBuf, + headersBuf ) while (rawHeaders.hasRemaining) { diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/FrameListener.scala b/http/src/main/scala/org/http4s/blaze/http/http2/FrameListener.scala index 89347b704..4d66c722a 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/FrameListener.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/FrameListener.scala @@ -77,7 +77,7 @@ private trait FrameListener { priority: Priority, endHeaders: Boolean, endStream: Boolean, - data: ByteBuffer, + data: ByteBuffer ): Result /** Called on successful receipt of a CONTINUATION frame @@ -140,7 +140,7 @@ private trait FrameListener { streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer, + data: ByteBuffer ): Result /** Called on successful receipt of a PING frame diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/FrameSerializer.scala b/http/src/main/scala/org/http4s/blaze/http/http2/FrameSerializer.scala index 5d3f90839..99c96f86b 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/FrameSerializer.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/FrameSerializer.scala @@ -48,7 +48,7 @@ private[http2] object FrameSerializer { streamId: Int, endStream: Boolean, padding: Int, - data: ByteBuffer, + data: ByteBuffer ): Seq[ByteBuffer] = { require(0 < streamId, "bad DATA frame stream id") require(0 <= padding && padding <= 256, "Invalid padding of DATA frame") @@ -79,7 +79,7 @@ private[http2] object FrameSerializer { endHeaders: Boolean, endStream: Boolean, padding: Int, - headerData: ByteBuffer, + headerData: ByteBuffer ): Seq[ByteBuffer] = { require(0 < streamId, "bad HEADER frame stream id") require(0 <= padding, "Invalid padding of HEADER frame") @@ -176,7 +176,7 @@ private[http2] object FrameSerializer { promiseId: Int, endHeaders: Boolean, padding: Int, - headerBuffer: ByteBuffer, + headerBuffer: ByteBuffer ): Seq[ByteBuffer] = { require(streamId != 0x0, "Invalid Stream id for PUSH_PROMISE frame") require(promiseId != 0x0 && promiseId % 2 == 0, "Invalid Stream id for PUSH_PROMISE frame") @@ -199,7 +199,7 @@ private[http2] object FrameSerializer { FrameTypes.PUSH_PROMISE, flags.toByte, streamId, - buffer, + buffer ) if (padded) @@ -250,7 +250,7 @@ private[http2] object FrameSerializer { require(0 <= streamId, "Invalid stream id for WINDOW_UPDATE") require( 0 < increment && increment <= Integer.MAX_VALUE, - "Invalid stream increment for WINDOW_UPDATE", + "Invalid stream increment for WINDOW_UPDATE" ) val size = 4 @@ -266,7 +266,7 @@ private[http2] object FrameSerializer { def mkContinuationFrame( streamId: Int, endHeaders: Boolean, - headerBuffer: ByteBuffer, + headerBuffer: ByteBuffer ): Seq[ByteBuffer] = { require(0 < streamId, "Invalid stream id for CONTINUATION frame") val flags: Byte = if (endHeaders) Flags.END_HEADERS else 0x0 @@ -306,7 +306,7 @@ private[http2] object FrameSerializer { frameType: Byte, flags: Byte, streamdId: Int, - buffer: ByteBuffer, + buffer: ByteBuffer ): Unit = { buffer .put((length >>> 16 & 0xff).toByte) diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListener.scala b/http/src/main/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListener.scala index 93dc938c9..8ea275c16 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListener.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListener.scala @@ -35,7 +35,7 @@ import Http2Exception.PROTOCOL_ERROR */ private abstract class HeaderAggregatingFrameListener( localSettings: Http2Settings, - headerDecoder: HeaderDecoder, + headerDecoder: HeaderDecoder ) extends FrameListener { private[this] sealed trait PartialFrame { def streamId: Int @@ -46,7 +46,7 @@ private abstract class HeaderAggregatingFrameListener( streamId: Int, priority: Priority, endStream: Boolean, - var buffer: ByteBuffer, + var buffer: ByteBuffer ) extends PartialFrame private[this] case class PPromise(streamId: Int, promisedId: Int, var buffer: ByteBuffer) @@ -71,7 +71,7 @@ private abstract class HeaderAggregatingFrameListener( streamId: Int, priority: Priority, endStream: Boolean, - headers: Headers, + headers: Headers ): Result /** Called on the successful receipt of a complete PUSH_PROMISE block @@ -97,7 +97,7 @@ private abstract class HeaderAggregatingFrameListener( priority: Priority, endHeaders: Boolean, endStream: Boolean, - buffer: ByteBuffer, + buffer: ByteBuffer ): Result = if (inHeaderSequence) Error( @@ -124,7 +124,7 @@ private abstract class HeaderAggregatingFrameListener( streamId: Int, promisedId: Int, endHeaders: Boolean, - buffer: ByteBuffer, + buffer: ByteBuffer ): Result = if (localSettings.maxHeaderListSize < buffer.remaining) headerSizeError(buffer.remaining, streamId) @@ -143,7 +143,7 @@ private abstract class HeaderAggregatingFrameListener( override final def onContinuationFrame( streamId: Int, endHeaders: Boolean, - buffer: ByteBuffer, + buffer: ByteBuffer ): Result = if (hInfo.streamId != streamId) { val msg = "Invalid CONTINUATION frame: stream Id's don't match. " + diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/HeaderDecoder.scala b/http/src/main/scala/org/http4s/blaze/http/http2/HeaderDecoder.scala index 2b8361dc2..4add9dfc2 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/HeaderDecoder.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/HeaderDecoder.scala @@ -41,7 +41,7 @@ import scala.util.control.NonFatal private final class HeaderDecoder( maxHeaderListSize: Int, discardOverflowHeaders: Boolean, - val maxTableSize: Int, + val maxTableSize: Int ) { require(maxTableSize >= DefaultSettings.HEADER_TABLE_SIZE) @@ -92,7 +92,7 @@ private final class HeaderDecoder( buffer: ByteBuffer, streamId: Int, endHeaders: Boolean, - listener: HeaderListener, + listener: HeaderListener ): MaybeError = { if (sawEndHeaders) throw new IllegalStateException("called doDecode() after receiving an endHeaders flag") diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/Http2Settings.scala b/http/src/main/scala/org/http4s/blaze/http/http2/Http2Settings.scala index 54ab63fb3..bbb2593f8 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/Http2Settings.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/Http2Settings.scala @@ -75,7 +75,7 @@ sealed abstract class Http2Settings { MAX_CONCURRENT_STREAMS(maxConcurrentStreams), INITIAL_WINDOW_SIZE(initialWindowSize), MAX_FRAME_SIZE(maxFrameSize), - MAX_HEADER_LIST_SIZE(maxHeaderListSize), + MAX_HEADER_LIST_SIZE(maxHeaderListSize) ) override def toString: String = s"Http2Settings($toSeq)" @@ -88,7 +88,7 @@ case class ImmutableHttp2Settings( pushEnabled: Boolean, maxConcurrentStreams: Int, maxFrameSize: Int, - maxHeaderListSize: Int, + maxHeaderListSize: Int ) extends Http2Settings object Http2Settings { @@ -123,7 +123,7 @@ object Http2Settings { pushEnabled = DefaultSettings.ENABLE_PUSH, // initially enabled maxConcurrentStreams = DefaultSettings.MAX_CONCURRENT_STREAMS, // initially unbounded maxFrameSize = DefaultSettings.MAX_FRAME_SIZE, - maxHeaderListSize = DefaultSettings.MAX_HEADER_LIST_SIZE, + maxHeaderListSize = DefaultSettings.MAX_HEADER_LIST_SIZE ) private def settingKey(id: Int): SettingKey = @@ -198,7 +198,7 @@ private[blaze] final class MutableHttp2Settings private ( var pushEnabled: Boolean, var maxConcurrentStreams: Int, var maxFrameSize: Int, - var maxHeaderListSize: Int, + var maxHeaderListSize: Int ) extends Http2Settings { // initially unbounded import MutableHttp2Settings._ @@ -240,7 +240,7 @@ private object MutableHttp2Settings { pushEnabled = settings.pushEnabled, maxConcurrentStreams = settings.maxConcurrentStreams, maxFrameSize = settings.maxFrameSize, - maxHeaderListSize = settings.maxHeaderListSize, + maxHeaderListSize = settings.maxHeaderListSize ) /** Create a new [[MutableHttp2Settings]] using the HTTP2 defaults */ diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/InboundStreamStateImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/InboundStreamStateImpl.scala index cfc93fadc..cbd58c3bf 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/InboundStreamStateImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/InboundStreamStateImpl.scala @@ -19,7 +19,7 @@ package org.http4s.blaze.http.http2 private final class InboundStreamStateImpl( session: SessionCore, val streamId: Int, - val flowWindow: StreamFlowWindow, + val flowWindow: StreamFlowWindow ) extends StreamStateImpl(session) with InboundStreamState { override def name: String = s"InboundStreamState($streamId)" diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/PingManager.scala b/http/src/main/scala/org/http4s/blaze/http/http2/PingManager.scala index 5e66a7002..e984d965f 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/PingManager.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/PingManager.scala @@ -64,11 +64,9 @@ private class PingManager(session: SessionCore) { case Pinging(sent, continuation) => state = Idle - if ( - ByteBuffer + if (ByteBuffer .wrap(data) - .getLong != sent - ) { // data guaranteed to be 8 bytes + .getLong != sent) { // data guaranteed to be 8 bytes val msg = "Received ping response with unknown data." val ex = new Exception(msg) logger.warn(ex)(msg) diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/SessionFlowControlImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/SessionFlowControlImpl.scala index d8344f06e..e45123c7c 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/SessionFlowControlImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/SessionFlowControlImpl.scala @@ -23,7 +23,7 @@ import org.log4s.getLogger /** Flow control representation of a Http2 Session */ private class SessionFlowControlImpl( session: SessionCore, - flowStrategy: FlowStrategy, + flowStrategy: FlowStrategy ) extends SessionFlowControl { private[this] val logger = getLogger diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/SessionFrameListener.scala b/http/src/main/scala/org/http4s/blaze/http/http2/SessionFrameListener.scala index c4da0174e..e9d305272 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/SessionFrameListener.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/SessionFrameListener.scala @@ -31,7 +31,7 @@ import org.http4s.blaze.http.http2.Http2Settings.Setting private class SessionFrameListener( session: SessionCore, isClient: Boolean, - headerDecoder: HeaderDecoder, + headerDecoder: HeaderDecoder ) extends HeaderAggregatingFrameListener(session.localSettings, headerDecoder) { // Concrete methods //////////////////////////////////////////////////////////////////// @@ -39,7 +39,7 @@ private class SessionFrameListener( streamId: Int, priority: Priority, endStream: Boolean, - headers: Headers, + headers: Headers ): Result = session.streamManager.get(streamId) match { case Some(stream) => @@ -57,7 +57,7 @@ private class SessionFrameListener( override def onCompletePushPromiseFrame( streamId: Int, promisedId: Int, - headers: Headers, + headers: Headers ): Result = if (!isClient) // A client cannot push. Thus, servers MUST treat the receipt of a diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/SettingsDecoder.scala b/http/src/main/scala/org/http4s/blaze/http/http2/SettingsDecoder.scala index ebff09308..c7c775ba0 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/SettingsDecoder.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/SettingsDecoder.scala @@ -69,7 +69,7 @@ private[blaze] object SettingsDecoder { def decodeSettingsFrame( buffer: ByteBuffer, streamId: Int, - flags: Byte, + flags: Byte ): Either[Http2Exception, SettingsFrame] = { import Http2Exception._ diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/StreamIdManager.scala b/http/src/main/scala/org/http4s/blaze/http/http2/StreamIdManager.scala index 6c3190901..1585389a2 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/StreamIdManager.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/StreamIdManager.scala @@ -35,7 +35,7 @@ private[http2] object StreamIdManager { private final class StreamIdManager private ( isClient: Boolean, private var nextInbound: Int, - private var nextOutbound: Int, + private var nextOutbound: Int ) { /** Get the last inbound stream to be observed, or 0 if no streams have been processed */ diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/StreamManagerImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/StreamManagerImpl.scala index 60e390bf8..a92282794 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/StreamManagerImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/StreamManagerImpl.scala @@ -24,7 +24,7 @@ import scala.concurrent.{Future, Promise} private final class StreamManagerImpl( session: SessionCore, - inboundStreamBuilder: Option[Int => LeafBuilder[StreamFrame]], + inboundStreamBuilder: Option[Int => LeafBuilder[StreamFrame]] ) extends StreamManager { private[this] val logger = org.log4s.getLogger private[this] val streams = new HashMap[Int, StreamState] diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/StreamStateImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/StreamStateImpl.scala index 9b3099d95..927881cd7 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/StreamStateImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/StreamStateImpl.scala @@ -212,7 +212,7 @@ private abstract class StreamStateImpl(session: SessionCore) extends StreamState override final def invokeInboundData( endStream: Boolean, data: ByteBuffer, - flowBytes: Int, + flowBytes: Int ): MaybeError = if (receivedEndStream) // https://tools.ietf.org/html/rfc7540#section-5.1 section 'half-closed' @@ -237,7 +237,7 @@ private abstract class StreamStateImpl(session: SessionCore) extends StreamState override final def invokeInboundHeaders( priority: Priority, endStream: Boolean, - headers: Headers, + headers: Headers ): MaybeError = if (receivedEndStream) // https://tools.ietf.org/html/rfc7540#section-5.1 section 'half-closed' diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/WriteControllerImpl.scala b/http/src/main/scala/org/http4s/blaze/http/http2/WriteControllerImpl.scala index a890423e0..2c8a96606 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/WriteControllerImpl.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/WriteControllerImpl.scala @@ -40,7 +40,7 @@ import scala.util.control.NonFatal private final class WriteControllerImpl( session: SessionCore, highWaterMark: Int, - tailStage: TailStage[ByteBuffer], + tailStage: TailStage[ByteBuffer] ) extends WriteController { import WriteControllerImpl._ @@ -109,7 +109,7 @@ private final class WriteControllerImpl( private[this] def addBuffs( dest: ArrayBuffer[ByteBuffer], - data: collection.Seq[ByteBuffer], + data: collection.Seq[ByteBuffer] ): Int = { var written = 0 data.foreach { buf => diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/server/ALPNServerSelector.scala b/http/src/main/scala/org/http4s/blaze/http/http2/server/ALPNServerSelector.scala index d9291189d..22095b471 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/server/ALPNServerSelector.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/server/ALPNServerSelector.scala @@ -39,7 +39,7 @@ import scala.util.control.NonFatal final class ALPNServerSelector( engine: SSLEngine, selector: Set[String] => String, - builder: String => LeafBuilder[ByteBuffer], + builder: String => LeafBuilder[ByteBuffer] ) extends TailStage[ByteBuffer] { engine.setHandshakeApplicationProtocolSelector( diff --git a/http/src/main/scala/org/http4s/blaze/http/http2/server/ServerPriorKnowledgeHandshaker.scala b/http/src/main/scala/org/http4s/blaze/http/http2/server/ServerPriorKnowledgeHandshaker.scala index 26e38531c..21eba12d1 100644 --- a/http/src/main/scala/org/http4s/blaze/http/http2/server/ServerPriorKnowledgeHandshaker.scala +++ b/http/src/main/scala/org/http4s/blaze/http/http2/server/ServerPriorKnowledgeHandshaker.scala @@ -28,7 +28,7 @@ import scala.util.Failure final class ServerPriorKnowledgeHandshaker( localSettings: ImmutableHttp2Settings, flowStrategy: FlowStrategy, - nodeBuilder: Int => LeafBuilder[StreamFrame], + nodeBuilder: Int => LeafBuilder[StreamFrame] ) extends PriorKnowledgeHandshaker[Unit](localSettings) { override protected def stageStartup(): Unit = synchronized { @@ -43,7 +43,7 @@ final class ServerPriorKnowledgeHandshaker( override protected def handshakeComplete( remoteSettings: MutableHttp2Settings, - data: ByteBuffer, + data: ByteBuffer ): Future[Unit] = Future(installHttp2ServerStage(remoteSettings, data)) @@ -64,7 +64,7 @@ final class ServerPriorKnowledgeHandshaker( // Setup the pipeline with a new Http2ClientStage and start it up, then return it. private def installHttp2ServerStage( remoteSettings: MutableHttp2Settings, - remainder: ByteBuffer, + remainder: ByteBuffer ): Unit = { logger.debug(s"Installing pipeline with settings: $remoteSettings") val tail = new BasicTail[ByteBuffer]("http2ServerTail") @@ -83,7 +83,7 @@ final class ServerPriorKnowledgeHandshaker( remoteSettings = remoteSettings, flowStrategy = flowStrategy, inboundStreamBuilder = Some(nodeBuilder), - parentExecutor = Execution.trampoline, + parentExecutor = Execution.trampoline ) () } diff --git a/http/src/main/scala/org/http4s/blaze/http/util/HeaderTools.scala b/http/src/main/scala/org/http4s/blaze/http/util/HeaderTools.scala index cee5ddd3a..dd2f55bd1 100644 --- a/http/src/main/scala/org/http4s/blaze/http/util/HeaderTools.scala +++ b/http/src/main/scala/org/http4s/blaze/http/util/HeaderTools.scala @@ -50,7 +50,7 @@ private[blaze] object HeaderTools { case class SpecialHeaders( transferEncoding: Option[String], contentLength: Option[String], - connection: Option[String], + connection: Option[String] ) def isKeepAlive(connectionHeader: Option[String], minorVersion: Int): Boolean = @@ -105,7 +105,7 @@ private[blaze] object HeaderTools { SpecialHeaders( transferEncoding, contentLength, - connection, + connection ) } } diff --git a/http/src/test/scala/org/http4s/blaze/http/BodyReaderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/BodyReaderSuite.scala index 56ca62ea3..b32f461e3 100644 --- a/http/src/test/scala/org/http4s/blaze/http/BodyReaderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/BodyReaderSuite.scala @@ -66,7 +66,7 @@ class BodyReaderSuite extends BlazeTestSuite { test("A BodyReader.accumulate(max, bodyReader) should accumulate multiple buffers") { val reader = new MultiByteReader( ByteBuffer.allocate(10), - ByteBuffer.allocate(1), + ByteBuffer.allocate(1) ) val bytes = BodyReader.accumulate(Int.MaxValue, reader).map(_.remaining()) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/ConnectionImplSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/ConnectionImplSuite.scala index e0d4e134e..c8510154a 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/ConnectionImplSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/ConnectionImplSuite.scala @@ -53,7 +53,7 @@ class ConnectionImplSuite extends BlazeTestSuite { remoteSettings = remoteSettings, flowStrategy = flowStrategy, inboundStreamBuilder = streamBuilder, - parentExecutor = Execution.trampoline, + parentExecutor = Execution.trampoline ) def decodeGoAway(data: ByteBuffer): ProtocolFrame = diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/FrameDecoderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/FrameDecoderSuite.scala index 472c864d0..8aea65dc1 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/FrameDecoderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/FrameDecoderSuite.scala @@ -37,7 +37,7 @@ class FrameDecoderSuite extends BlazeTestSuite { streamId: Int, endStream: Boolean, data: ByteBuffer, - flowSize: Int, + flowSize: Int ): Result = { this.streamId = Some(streamId) this.endStream = Some(endStream) @@ -82,7 +82,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, // length 0x00, // type 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // streamId + 0x00, 0x00, 0x00, 0x01 // streamId ) // no data val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -114,7 +114,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00, + 0x00 ) val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -143,7 +143,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00, + 0x00 ) val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -175,7 +175,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00, + 0x00 ) val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -207,7 +207,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00, + 0x00 ) val listener = new DataListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -245,7 +245,7 @@ class FrameDecoderSuite extends BlazeTestSuite { priority: Priority, end_headers: Boolean, end_stream: Boolean, - buffer: ByteBuffer, + buffer: ByteBuffer ): Result = { this.streamId = Some(streamId) this.priority = Some(priority) @@ -305,7 +305,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0xff.toByte, // weight 0x00, 0x00, - 0x00, + 0x00 ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -337,7 +337,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00, + 0x00 ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -369,7 +369,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x02, // dependent stream 2, non-exclusive 0x02, // weight 3 0x00, - 0x01, + 0x01 ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -401,7 +401,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x01, + 0x01 ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -449,7 +449,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x02, // weight 3 0x00, 0x00, - 0x01, + 0x01 ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -479,7 +479,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x02, // weight 3 0x00, 0x00, - 0x01, + 0x01 ) val listener = new HeadersListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -534,7 +534,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x02, // stream dependency 2 - 0x00, + 0x00 ) val listener = new PriorityListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -586,7 +586,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x02, // type 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId - 0x00, 0x00, 0x00, 0x02, // stream dependency + 0x00, 0x00, 0x00, 0x02 // stream dependency ) // missing weight val listener = new PriorityListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -618,7 +618,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x03, // type 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId - 0x00, 0x00, 0x00, 0x02, // code + 0x00, 0x00, 0x00, 0x02 // code ) // missing weight val listener = new RstListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -635,7 +635,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x03, // type 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId - 0x00, 0x00, 0x00, 0x00, // code + 0x00, 0x00, 0x00, 0x00 // code ) // missing weight val listener = new RstListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -653,7 +653,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x03, // type 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId - 0x00, 0x00, 0x00, // code + 0x00, 0x00, 0x00 // code ) // missing weight val listener = new RstListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -671,7 +671,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x03, // type 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId - 0x00, 0x00, 0x00, 0x00, 0x00, // code + 0x00, 0x00, 0x00, 0x00, 0x00 // code ) // missing weight val listener = new RstListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -702,7 +702,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, // length 0x04, // type 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // streamId + 0x00, 0x00, 0x00, 0x00 // streamId // body ) val listener = new SettingsListener @@ -723,7 +723,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00, // streamId + 0x00 // streamId // body ) val listener = new SettingsListener @@ -741,7 +741,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId 0x00, 0x00, // key - 0x00, 0x00, 0x00, 0x01, // value + 0x00, 0x00, 0x00, 0x01 // value // body ) val listener = new SettingsListener @@ -757,7 +757,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, // length 0x04, // type 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // streamId + 0x00, 0x00, 0x00, 0x01 // streamId // body ) // missing weight val listener = new SettingsListener @@ -786,7 +786,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x01, // value + 0x01 // value // body ) val listener = new SettingsListener @@ -806,7 +806,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 ) // missing weight val listener = new SettingsListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -826,7 +826,7 @@ class FrameDecoderSuite extends BlazeTestSuite { streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer, + data: ByteBuffer ): Result = { this.streamId = Some(streamId) this.promisedId = Some(promisedId) @@ -854,7 +854,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x02, // promised id + 0x00, 0x00, 0x00, 0x02 // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -882,7 +882,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x02, // promised id + 0x02 // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -911,7 +911,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x02, // promised id + 0x02 // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -942,7 +942,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x02, // promised id 0x00, - 0x01, // the padding + 0x01 // the padding ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -962,7 +962,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x00, 0x00, 0x00, 0x02, // promised id + 0x00, 0x00, 0x00, 0x02 // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -981,7 +981,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x01, // promised id + 0x00, 0x00, 0x00, 0x01 // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1000,7 +1000,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x01, // promised id + 0x00, 0x00, 0x00, 0x01 // promised id ) val listener = new PushListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1037,7 +1037,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x00, // opaque data - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1067,7 +1067,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, - 0x00, + 0x00 ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1086,7 +1086,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x01, // streamId // body 0x00, 0x00, 0x00, 0x00, // opaque data - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1106,7 +1106,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x00, // opaque data - 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1126,7 +1126,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x00, // opaque data - 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00 ) val listener = new PingListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1166,7 +1166,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x01, // last stream - 0x00, 0x00, 0x00, 0x00, // error code + 0x00, 0x00, 0x00, 0x00 // error code ) val listener = new GoAwayListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1187,7 +1187,7 @@ class FrameDecoderSuite extends BlazeTestSuite { // body 0x00, 0x00, 0x00, 0x01, // last stream 0x00, 0x00, 0x00, 0x00, // error code - 0x01, + 0x01 ) val listener = new GoAwayListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1208,7 +1208,7 @@ class FrameDecoderSuite extends BlazeTestSuite { // body 0x00, 0x00, 0x00, 0x01, // last stream 0x00, 0x00, 0x00, 0x00, // error code - 0x01, + 0x01 ) val listener = new GoAwayListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1241,7 +1241,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x00, 0x00, 0x00, 0x01, // increment + 0x00, 0x00, 0x00, 0x01 // increment ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1259,7 +1259,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x00, 0x00, 0x00, 0x00, // increment + 0x00, 0x00, 0x00, 0x00 // increment ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1278,7 +1278,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x00, 0x00, 0x00, 0x00, // increment + 0x00, 0x00, 0x00, 0x00 // increment ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1297,7 +1297,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x00, 0x00, 0x00, // increment + 0x00, 0x00, 0x00 // increment ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1317,7 +1317,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x00, 0x00, 0x00, // streamId // body 0x00, 0x00, 0x00, 0x01, // increment - 0x00, + 0x00 ) val listener = new WindowListener val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1335,7 +1335,7 @@ class FrameDecoderSuite extends BlazeTestSuite { override def onContinuationFrame( streamId: Int, endHeaders: Boolean, - data: ByteBuffer, + data: ByteBuffer ): Result = { this.streamId = Some(streamId) this.endHeaders = Some(endHeaders) @@ -1356,7 +1356,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x01, // streamId // body - 0x01, // increment + 0x01 // increment ) val listener = new ContinuationListener(true) val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1375,7 +1375,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, // flags 0x00, 0x00, 0x00, 0x00, // streamId // body - 0x01, // increment + 0x01 // increment ) val listener = new ContinuationListener(true) val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1399,7 +1399,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x01, // streamId // body - 0x01, // increment + 0x01 // increment ) val listener = new ContinuationListener(true) val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1423,7 +1423,7 @@ class FrameDecoderSuite extends BlazeTestSuite { 0x00, 0x01, // streamId // body - 0x01, // increment + 0x01 // increment ) val listener = new ContinuationListener(false) val dec = new FrameDecoder(Http2Settings.default, listener) @@ -1455,7 +1455,7 @@ class FrameDecoderSuite extends BlazeTestSuite { _code: Byte, _streamId: Int, _flags: Byte, - buffer: ByteBuffer, + buffer: ByteBuffer ): Result = { data = buffer code = Some(_code) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/FrameEncoderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/FrameEncoderSuite.scala index b5d2c5d2e..48eb66bb9 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/FrameEncoderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/FrameEncoderSuite.scala @@ -32,7 +32,7 @@ class FrameEncoderSuite extends BlazeTestSuite { onHeadersFrameMock: (Int, Priority, Boolean, Boolean, ByteBuffer) => Result = (_, _, _, _, _) => BufferUnderflow, inHeaderSequenceMock: Boolean = false, - onContinuationFrameMock: (Int, Boolean, ByteBuffer) => Result = (_, _, _) => BufferUnderflow, + onContinuationFrameMock: (Int, Boolean, ByteBuffer) => Result = (_, _, _) => BufferUnderflow ) = new FrameListener { def inHeaderSequence: Boolean = inHeaderSequenceMock @@ -44,7 +44,7 @@ class FrameEncoderSuite extends BlazeTestSuite { priority: Priority, endHeaders: Boolean, endStream: Boolean, - data: ByteBuffer, + data: ByteBuffer ): Result = onHeadersFrameMock(streamId, priority, endHeaders, endStream, data) @@ -61,7 +61,7 @@ class FrameEncoderSuite extends BlazeTestSuite { streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer, + data: ByteBuffer ): Result = ??? def onPingFrame(ack: Boolean, data: Array[Byte]): Result = ??? @@ -199,7 +199,7 @@ class FrameEncoderSuite extends BlazeTestSuite { case (1, true, `zeroBuffer5`) => ReturnTag(2) case _ => throw new IllegalStateException("Unexpected arguments for onContinuationFrame") }, - inHeaderSequenceMock = true, + inHeaderSequenceMock = true ) val decoder2 = new FrameDecoder(tools.remoteSettings, listener2) @@ -238,7 +238,7 @@ class FrameEncoderSuite extends BlazeTestSuite { case (1, true, `zeroBuffer5`) => ReturnTag(2) case _ => throw new IllegalStateException("Unexpected arguments for onHeadersFrame") }, - inHeaderSequenceMock = true, + inHeaderSequenceMock = true ) val decoder2 = new FrameDecoder(tools.remoteSettings, listener2) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/FrameSerializerSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/FrameSerializerSuite.scala index a6f1e15db..c74dbb654 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/FrameSerializerSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/FrameSerializerSuite.scala @@ -59,7 +59,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { streamId: Int, isLast: Boolean, data: ByteBuffer, - flowSize: Int, + flowSize: Int ): org.http4s.blaze.http.http2.Result = { assertEquals(streamId, dataFrame.streamId) assertEquals(isLast, dataFrame.endStream) @@ -78,7 +78,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { dataFrame.streamId, dataFrame.endStream, dataFrame.padding, - dataFrame.data.duplicate(), + dataFrame.data.duplicate() ) ) dec(dataFrame).decodeBuffer(frame) == Continue @@ -99,7 +99,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { endHeaders: Boolean, endStream: Boolean, data: ByteBuffer, - padding: Int, + padding: Int ) { def flowSize: Int = data.remaining + padding } @@ -127,7 +127,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { priority: Priority, end_headers: Boolean, end_stream: Boolean, - buffer: ByteBuffer, + buffer: ByteBuffer ): org.http4s.blaze.http.http2.Result = { assertEquals(headerFrame.streamId, streamId) assertEquals(headerFrame.priority, priority) @@ -149,7 +149,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { headerFrame.endHeaders, headerFrame.endStream, headerFrame.padding, - headerFrame.data.duplicate, + headerFrame.data.duplicate ) ) @@ -163,7 +163,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { assertEquals( dec(HeadersFrame(1, Priority.NoPriority, true, true, dat, 0)) .decodeBuffer(buff1), - Continue, + Continue ) assertEquals(buff1.remaining(), 0) @@ -181,7 +181,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { assertEquals( dec(HeadersFrame(1, Priority.NoPriority, true, true, dat, paddingSize)) .decodeBuffer(buff), - Continue, + Continue ) } @@ -205,7 +205,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { decoder(new MockFrameListener(false) { override def onPriorityFrame( streamId: Int, - priority: Priority.Dependent, + priority: Priority.Dependent ): org.http4s.blaze.http.http2.Result = { assertEquals(priorityFrame.streamId, streamId) assertEquals(priorityFrame.priority, priority) @@ -254,7 +254,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { decoder(new MockFrameListener(false) { override def onRstStreamFrame( streamId: Int, - code: Long, + code: Long ): org.http4s.blaze.http.http2.Result = { assertEquals(rstFrame.streamId, streamId) assertEquals(rstFrame.code, code) @@ -311,7 +311,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { decoder(new MockHeaderAggregatingFrameListener { override def onPingFrame( ack: Boolean, - data: Array[Byte], + data: Array[Byte] ): org.http4s.blaze.http.http2.Result = { assertEquals(pingFrame.ack, ack) assert(util.Arrays.equals(pingFrame.data, data)) @@ -342,7 +342,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { override def onGoAwayFrame( lastStream: Int, errorCode: Long, - debugData: Array[Byte], + debugData: Array[Byte] ): org.http4s.blaze.http.http2.Result = { assertEquals(goAway.lastStream, lastStream) assertEquals(goAway.err, errorCode) @@ -371,7 +371,7 @@ class FrameSerializerSuite extends BlazeTestSuite with ScalaCheckSuite { decoder(new MockHeaderAggregatingFrameListener { override def onWindowUpdateFrame( streamId: Int, - sizeIncrement: Int, + sizeIncrement: Int ): org.http4s.blaze.http.http2.Result = { assertEquals(update.streamId, streamId) assertEquals(update.increment, sizeIncrement) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListenerSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListenerSuite.scala index 2756e1eb7..955ba8e3f 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListenerSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderAggregatingFrameListenerSuite.scala @@ -38,7 +38,7 @@ class HeaderAggregatingFrameListenerSuite extends BlazeTestSuite { streamId: Int, priority: Priority, end_stream: Boolean, - headers: Headers, + headers: Headers ): Result = { assertEquals(sId, streamId) assertEquals(p, priority) @@ -56,7 +56,7 @@ class HeaderAggregatingFrameListenerSuite extends BlazeTestSuite { assertEquals( mkDecoder(1, Priority.NoPriority, true, hs).decodeBuffer(BufferTools.joinBuffers(bs)), - Halt, + Halt ) } @@ -157,7 +157,7 @@ class HeaderAggregatingFrameListenerSuite extends BlazeTestSuite { streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer, + data: ByteBuffer ): Result = { assertEquals(sId, streamId) assertEquals(pId, promisedId) @@ -198,7 +198,7 @@ class HeaderAggregatingFrameListenerSuite extends BlazeTestSuite { override def onCompletePushPromiseFrame( streamId: Int, promisedId: Int, - headers: Headers, + headers: Headers ): Result = { assertEquals(sId, streamId) assertEquals(pId, promisedId) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderDecoderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderDecoderSuite.scala index e4ee4380b..c228154c5 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderDecoderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderDecoderSuite.scala @@ -74,11 +74,11 @@ class HeaderDecoderSuite extends BlazeTestSuite { test("A HeaderDecoder should now overflow the maxHeaderBlockSize") { val bb = HeaderCodecHelpers.encodeHeaders( testHeaders ++ testHeaders, - Http2Settings.DefaultSettings.HEADER_TABLE_SIZE, + Http2Settings.DefaultSettings.HEADER_TABLE_SIZE ) val dec = new HeaderDecoder( headersBlockSize, /*discardOnOverflow*/ true, - Http2Settings.DefaultSettings.HEADER_TABLE_SIZE, + Http2Settings.DefaultSettings.HEADER_TABLE_SIZE ) assertEquals(dec.decode(bb, -1, true), Continue) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderEncoderSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderEncoderSuite.scala index 2417c843e..f1e64312d 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/HeaderEncoderSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/HeaderEncoderSuite.scala @@ -27,7 +27,7 @@ class HeaderEncoderSuite extends BlazeTestSuite { assertEquals( HeaderCodecHelpers.decodeHeaders(bb, Http2Settings.DefaultSettings.HEADER_TABLE_SIZE), - headers, + headers ) } } diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/ProtocolFrameDecoder.scala b/http/src/test/scala/org/http4s/blaze/http/http2/ProtocolFrameDecoder.scala index c0ada3f65..e0d9ea1fd 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/ProtocolFrameDecoder.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/ProtocolFrameDecoder.scala @@ -47,7 +47,7 @@ private[http2] object ProtocolFrameDecoder { def decode( buffer: ByteBuffer, inHeadersSequence: Boolean = false, - maxFrameSize: Int = Http2Settings.default.maxFrameSize, + maxFrameSize: Int = Http2Settings.default.maxFrameSize ): ProtocolFrame = { val listener = new Listener(inHeadersSequence) val decoder = new FrameDecoder(toSettings(maxFrameSize), listener) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/ServerPriorKnowledgeHandshakerSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/ServerPriorKnowledgeHandshakerSuite.scala index 5b590e3f7..776a11b0d 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/ServerPriorKnowledgeHandshakerSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/ServerPriorKnowledgeHandshakerSuite.scala @@ -32,7 +32,7 @@ class ServerPriorKnowledgeHandshakerSuite extends BlazeTestSuite { new ServerPriorKnowledgeHandshaker( localSettings = localSettings, flowStrategy = flowStrategy, - nodeBuilder = _ => ???, + nodeBuilder = _ => ??? ) } diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/SessionFlowControlSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/SessionFlowControlSuite.scala index 9ed68015c..ab88af612 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/SessionFlowControlSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/SessionFlowControlSuite.scala @@ -312,7 +312,7 @@ class SessionFlowControlSuite extends BlazeTestSuite { assertEquals( flow.outboundRequest(DefaultSettings.INITIAL_WINDOW_SIZE), - DefaultSettings.INITIAL_WINDOW_SIZE, + DefaultSettings.INITIAL_WINDOW_SIZE ) assertEquals(flow.streamOutboundWindow, 0) assertEquals(session.sessionOutboundWindow, 0) @@ -324,7 +324,7 @@ class SessionFlowControlSuite extends BlazeTestSuite { assertEquals( flow.outboundRequest(DefaultSettings.INITIAL_WINDOW_SIZE + 1), - DefaultSettings.INITIAL_WINDOW_SIZE, + DefaultSettings.INITIAL_WINDOW_SIZE ) assertEquals(flow.streamOutboundWindow, 0) assertEquals(session.sessionOutboundWindow, 0) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/SessionFrameListenerSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/SessionFrameListenerSuite.scala index 295925f72..19769e336 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/SessionFrameListenerSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/SessionFrameListenerSuite.scala @@ -34,7 +34,7 @@ class SessionFrameListenerSuite extends BlazeTestSuite { new HeaderDecoder( localSettings.maxHeaderListSize, true, // discard overflow headers - localSettings.headerTableSize, + localSettings.headerTableSize ) lazy val newInboundStream: Option[Int => LeafBuilder[StreamFrame]] = None @@ -58,7 +58,7 @@ class SessionFrameListenerSuite extends BlazeTestSuite { streamId = os.streamId, priority = Priority.NoPriority, endStream = false, - headers = hs, + headers = hs ) os.readRequest(1).value match { @@ -83,7 +83,7 @@ class SessionFrameListenerSuite extends BlazeTestSuite { streamId = 1, priority = Priority.NoPriority, endStream = false, - headers = hs, + headers = hs ) assert(tools.streamManager.get(1).isDefined) @@ -128,7 +128,7 @@ class SessionFrameListenerSuite extends BlazeTestSuite { override def handlePushPromise( streamId: Int, promisedId: Int, - headers: Headers, + headers: Headers ) = { sId = streamId pId = promisedId @@ -294,14 +294,14 @@ class SessionFrameListenerSuite extends BlazeTestSuite { val tools = new MockTools(true) { override def invokeGoAway( lastHandledOutboundStream: Int, - reason: Http2SessionException, + reason: Http2SessionException ): Unit = observedGoAway = Some(lastHandledOutboundStream -> reason) } assertEquals( tools.frameListener.onGoAwayFrame(1, NO_ERROR.code, "lol".getBytes(StandardCharsets.UTF_8)), - Continue, + Continue ) observedGoAway match { diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/StreamFlowWindowSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/StreamFlowWindowSuite.scala index 16654970c..407a0f352 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/StreamFlowWindowSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/StreamFlowWindowSuite.scala @@ -52,7 +52,7 @@ class StreamFlowWindowSuite extends BlazeTestSuite { tools.sessionFlowControl .newStreamFlowWindow(1) .outboundRequest(initialSessionWindow), - initialSessionWindow, + initialSessionWindow ) assertEquals(window.outboundWindow, 0) } @@ -89,7 +89,7 @@ class StreamFlowWindowSuite extends BlazeTestSuite { tools.sessionFlowControl .newStreamFlowWindow(1) .outboundRequest(initialSessionWindow), - initialSessionWindow, + initialSessionWindow ) assertEquals(window2.outboundWindowAvailable, false) // both depleted diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/StreamStateImplSuite.scala b/http/src/test/scala/org/http4s/blaze/http/http2/StreamStateImplSuite.scala index aabada175..47157c92e 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/StreamStateImplSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/StreamStateImplSuite.scala @@ -40,7 +40,7 @@ class StreamStateImplSuite extends BlazeTestSuite { } override protected def onStreamBytesConsumed( stream: StreamFlowWindow, - consumed: Int, + consumed: Int ): Unit = { streamConsumed += consumed () @@ -53,7 +53,7 @@ class StreamStateImplSuite extends BlazeTestSuite { lazy val streamState: StreamStateImpl = new InboundStreamStateImpl( session = tools, streamId = streamId, - flowWindow = tools.sessionFlowControl.newStreamFlowWindow(streamId), + flowWindow = tools.sessionFlowControl.newStreamFlowWindow(streamId) ) } @@ -202,7 +202,7 @@ class StreamStateImplSuite extends BlazeTestSuite { assertEquals( streamState .invokeInboundData(endStream = false, data = BufferTools.allocate(1), flowBytes = 1), - Continue, + Continue ) assertEquals(streamConsumed.dequeue(), 1) @@ -250,7 +250,7 @@ class StreamStateImplSuite extends BlazeTestSuite { streamState.invokeInboundData( endStream = false, data = BufferTools.emptyBuffer, - flowBytes = streamState.flowWindow.streamInboundWindow + 1, + flowBytes = streamState.flowWindow.streamInboundWindow + 1 ) match { case Error(ex: Http2SessionException) => assertEquals(ex.code, Http2Exception.FLOW_CONTROL_ERROR.code) @@ -282,7 +282,7 @@ class StreamStateImplSuite extends BlazeTestSuite { streamState.invokeInboundData( endStream = false, data = BufferTools.emptyBuffer, - flowBytes = tools.sessionFlowControl.sessionInboundWindow + 1, + flowBytes = tools.sessionFlowControl.sessionInboundWindow + 1 ) match { case Error(ex: Http2SessionException) => assertEquals(ex.code, Http2Exception.FLOW_CONTROL_ERROR.code) diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockFrameListener.scala b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockFrameListener.scala index 09b1e14e6..0dc247a46 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockFrameListener.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockFrameListener.scala @@ -29,7 +29,7 @@ private[http2] class MockFrameListener(inHeaders: Boolean) extends FrameListener streamId: Int, promisedId: Int, end_headers: Boolean, - data: ByteBuffer, + data: ByteBuffer ): Result = ??? // For handling unknown stream frames @@ -38,7 +38,7 @@ private[http2] class MockFrameListener(inHeaders: Boolean) extends FrameListener priority: Priority, end_headers: Boolean, end_stream: Boolean, - buffer: ByteBuffer, + buffer: ByteBuffer ): Result = ??? override def onSettingsFrame(settings: Option[Seq[Setting]]): Result = ??? override def onRstStreamFrame(streamId: Int, code: Long): Result = ??? @@ -49,7 +49,7 @@ private[http2] class MockFrameListener(inHeaders: Boolean) extends FrameListener streamId: Int, isLast: Boolean, data: ByteBuffer, - flowSize: Int, + flowSize: Int ): Result = ??? override def onWindowUpdateFrame(streamId: Int, sizeIncrement: Int): Result = ??? } diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockHeaderAggregatingFrameListener.scala b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockHeaderAggregatingFrameListener.scala index 230df717e..53823a1f3 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockHeaderAggregatingFrameListener.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/MockHeaderAggregatingFrameListener.scala @@ -25,18 +25,18 @@ import org.http4s.blaze.http.http2._ private[http2] class MockHeaderAggregatingFrameListener extends HeaderAggregatingFrameListener( Http2Settings.default, - new HeaderDecoder(20 * 1024, true, 4096), + new HeaderDecoder(20 * 1024, true, 4096) ) { override def onCompletePushPromiseFrame( streamId: Int, promisedId: Int, - headers: Headers, + headers: Headers ): Result = ??? override def onCompleteHeadersFrame( streamId: Int, priority: Priority, end_stream: Boolean, - headers: Headers, + headers: Headers ): Result = ??? override def onGoAwayFrame(lastStream: Int, errorCode: Long, debugData: Array[Byte]): Result = ??? override def onPingFrame(ack: Boolean, data: Array[Byte]): Result = ??? @@ -48,7 +48,7 @@ private[http2] class MockHeaderAggregatingFrameListener streamId: Int, isLast: Boolean, data: ByteBuffer, - flowSize: Int, + flowSize: Int ): Result = ??? override def onPriorityFrame(streamId: Int, priority: Priority.Dependent): Result = ??? override def onWindowUpdateFrame(streamId: Int, sizeIncrement: Int): Result = ??? diff --git a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/ObservingSessionFlowControl.scala b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/ObservingSessionFlowControl.scala index 7e3a0ba75..363ee4fa7 100644 --- a/http/src/test/scala/org/http4s/blaze/http/http2/mocks/ObservingSessionFlowControl.scala +++ b/http/src/test/scala/org/http4s/blaze/http/http2/mocks/ObservingSessionFlowControl.scala @@ -23,7 +23,7 @@ private[http2] class ObservingSessionFlowControl( session: SessionCore ) extends SessionFlowControlImpl( session = session, - flowStrategy = null, /* only used on two overridden methods */ + flowStrategy = null /* only used on two overridden methods */ ) { override protected def onSessonBytesConsumed(consumed: Int): Unit = () override protected def onStreamBytesConsumed(stream: StreamFlowWindow, consumed: Int): Unit = () diff --git a/http/src/test/scala/org/http4s/blaze/http/parser/BenchParser.scala b/http/src/test/scala/org/http4s/blaze/http/parser/BenchParser.scala index f4be61386..569ad7e26 100644 --- a/http/src/test/scala/org/http4s/blaze/http/parser/BenchParser.scala +++ b/http/src/test/scala/org/http4s/blaze/http/parser/BenchParser.scala @@ -34,7 +34,7 @@ class BenchParser(maxReq: Int = 1034, maxHeader: Int = 1024) uri: String, scheme: String, majorversion: Int, - minorversion: Int, + minorversion: Int ): Boolean = false def headerComplete(name: String, value: String) = false diff --git a/http/src/test/scala/org/http4s/blaze/http/parser/ClientParserSuite.scala b/http/src/test/scala/org/http4s/blaze/http/parser/ClientParserSuite.scala index ed21bc791..dcf200aa4 100644 --- a/http/src/test/scala/org/http4s/blaze/http/parser/ClientParserSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/parser/ClientParserSuite.scala @@ -61,7 +61,7 @@ class ClientParserSuite extends BlazeTestSuite { reason: String, scheme: String, majorversion: Int, - minorversion: Int, + minorversion: Int ): Unit = { this.code = code this.reason = reason diff --git a/http/src/test/scala/org/http4s/blaze/http/parser/ResponseParser.scala b/http/src/test/scala/org/http4s/blaze/http/parser/ResponseParser.scala index 85aeaca6d..257029500 100644 --- a/http/src/test/scala/org/http4s/blaze/http/parser/ResponseParser.scala +++ b/http/src/test/scala/org/http4s/blaze/http/parser/ResponseParser.scala @@ -75,7 +75,7 @@ class ResponseParser extends Http1ClientParser { reason: String, scheme: String, majorversion: Int, - minorversion: Int, + minorversion: Int ): Unit = { this.code = code this.reason = reason diff --git a/http/src/test/scala/org/http4s/blaze/http/parser/ServerParserSuite.scala b/http/src/test/scala/org/http4s/blaze/http/parser/ServerParserSuite.scala index 74c66b790..dbc711918 100644 --- a/http/src/test/scala/org/http4s/blaze/http/parser/ServerParserSuite.scala +++ b/http/src/test/scala/org/http4s/blaze/http/parser/ServerParserSuite.scala @@ -56,7 +56,7 @@ class ServerParserSuite extends BlazeTestSuite { uri: String, scheme: String, majorversion: Int, - minorversion: Int, + minorversion: Int ) = { // println(s"$methodString, $uri, $scheme/$majorversion.$minorversion") minorv = minorversion @@ -231,7 +231,7 @@ class ServerParserSuite extends BlazeTestSuite { assert(p.parseheaders(hsStr)) assertEquals( p.getContentType, - EndOfContent.END, + EndOfContent.END ) // since the headers didn't indicate any content assertEquals(p.h.result(), List.fill(4)(("If-Modified-Since", ""))) }