Skip to content

Instantly share code, notes, and snippets.

/post.scala

Created Apr 18, 2017
Embed
What would you like to do?
the description for this gist
class NeutralGraphStage extends GraphStage[BidiShape[ByteString, ByteString, ByteString, ByteString]] {
// some parts ommited, you can see full version at github
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) {
setHandler(sslIn, new InHandler {
override def onPush() = push(bytesOut, grab(sslIn))
})
setHandler(bytesIn, new InHandler {
override def onPush() = push(sslOut, grab(bytesIn))
})
setHandler(bytesOut, new OutHandler {
override def onPull() = pull(sslIn)
})
setHandler(sslOut, new OutHandler {
override def onPull() = pull(bytesIn)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment