Instantly share code, notes, and snippets.

View gist:27407e31ac6dc3f319da073ed084f159
2018-09-16 14:11:10.473 ERROR 9041 --- [io2-8888-exec-4] : Remaining data in the network buffer, can't send SSL close message, force a close with close(true) instead
at ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at$SocketProcessor.doRun( [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at java.util.concurrent.ThreadPoolExecutor.runWorker( [na:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$
View PoolingTest.scala
it should "call createTransport only once when sharing sessions" in {
val counter = new AtomicInteger
val spied =
(x: Stack.Params) => {
View client.scala
object Foo {
def withTls(hostname: String, ciphers: Array[String]): Client = {
val socketAddressToEngine: SocketAddress => Engine = {
case sa: InetSocketAddress =>
val c = Ssl.client(hostname, sa.getPort)
case _ =>
val c = Ssl.client()
View HttpProxyConnectHandler.scala
package com.twitter.finagle.netty3.proxy
import com.twitter.finagle._
import com.twitter.finagle.client.Transporter
import com.twitter.finagle.client.Transporter.Credentials
import com.twitter.util.Base64StringEncoder
import{InetSocketAddress, SocketAddress}
import java.util.concurrent.atomic.AtomicReference
View Weird.scala
// Scala 2.11.6-2.11.8
object WeirdCompileError {
import java.util
import javax.servlet.http.HttpServletRequest
// In HttpServletRequest: public Enumeration<String> getHeaderNames();
// Error
import com.twitter.util.Function;
public class Test {
public void test() {
final PartialFunction<Tuple2<Object, Try<Response>>, scala.Boolean> decider =
new Function<Tuple2<Object,Try<Response>>, Boolean>() {
public scala.Boolean apply(Tuple2<Object, Try<Response>> v1) {
if (v1._2().isReturn()) {
View FailoveringService.scala
* Wraps two services in a new service which checks whether the {{primaryService}} is
* available and uses it when it is available. Otherwise, it will use the {{backupService}}.
class FailoveringService[Req, Rep](primaryService: Service[Req, Rep],
backupService: Service[Req, Rep])
extends Service[Req, Rep] {
override def apply(request: Req) =
import com.twitter.finagle.Service;
import com.twitter.util.Future;
import com.twitter.util.Promise;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
public class Convert {
static public <Res> Future<Res> fromObservable(final Observable<Res> observable) {
View NackTest.scala
package com.twitter.finagle.httpx
import com.twitter.finagle._
import com.twitter.util.{Await, Future}
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{FunSuite, ShouldMatchers}
import scala.compat.Platform
View Generator.scala
package nl.spockz.spray.routing.generator
import spray.routing.Route
object Generator {
def fromJaxRsAnnotatedPackage(packageName: String) : Route = _ => Unit