2016-07-11 00:04:31 +02:00
|
|
|
{-# LANGUAGE LambdaCase #-}
|
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2016-06-06 19:54:43 +02:00
|
|
|
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
|
|
|
|
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
|
2016-06-03 19:34:09 +02:00
|
|
|
|
2016-06-06 19:54:43 +02:00
|
|
|
import Control.Monad
|
|
|
|
import Network.GRPC.LowLevel
|
2016-07-11 00:04:31 +02:00
|
|
|
import Network.GRPC.LowLevel.Call
|
2016-06-08 21:38:01 +02:00
|
|
|
import qualified Network.GRPC.LowLevel.Client.Unregistered as U
|
2016-07-11 00:04:31 +02:00
|
|
|
import System.Environment
|
2016-06-03 19:34:09 +02:00
|
|
|
|
|
|
|
echoMethod = MethodName "/echo.Echo/DoEcho"
|
|
|
|
|
2016-07-11 00:04:31 +02:00
|
|
|
_unregistered c = U.clientRequest c echoMethod 1 "hi" mempty
|
2016-06-03 19:34:09 +02:00
|
|
|
|
2016-07-11 00:04:31 +02:00
|
|
|
main = withGRPC $ \g ->
|
|
|
|
withClient g (ClientConfig "localhost" 50051 []) $ \c -> do
|
|
|
|
rm <- clientRegisterMethod c echoMethod Normal
|
|
|
|
replicateM_ 100000 $ clientRequest c rm 5 "hi" mempty >>= \case
|
2016-06-06 19:54:43 +02:00
|
|
|
Left e -> error $ "Got client error: " ++ show e
|
|
|
|
_ -> return ()
|