test_ssl.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. 
  2. #include "hello_test.h"
  3. #if TARS_SSL
  4. //
  5. //TEST_F(HelloTest, sslSyncClient)
  6. //{
  7. // shared_ptr<Communicator> c = std::make_shared<Communicator>();
  8. // TC_Config conf = CLIENT_CONFIG();
  9. //
  10. // c->setProperty(conf);
  11. //
  12. // try
  13. // {
  14. //
  15. // HelloPrx prx = c->stringToProxy<HelloPrx>("TestApp.SSLServer.SSLObj@ssl -h 127.0.0.1 -p 9005 -t 10000");
  16. // prx->tars_ping();
  17. // LOG_CONSOLE_DEBUG << "prx succ" << endl;
  18. //
  19. // HelloPrx prx1 = c->stringToProxy<HelloPrx>("TestApp.SSLServer.SSL1Obj@ssl -h 127.0.0.1 -p 9006 -t 10000");
  20. // prx1->tars_ping();
  21. // LOG_CONSOLE_DEBUG << "prx1 succ" << endl;
  22. //
  23. // HelloPrx prx2 = c->stringToProxy<HelloPrx>("TestApp.SSLServer.SSL2Obj@ssl -h 127.0.0.1 -p 9007 -t 10000");
  24. // prx2->tars_ping();
  25. // LOG_CONSOLE_DEBUG << "prx2 succ" << endl;
  26. //
  27. // HelloPrx prx3 = c->stringToProxy<HelloPrx>("TestApp.SSLServer.SSL3Obj@ssl -h 127.0.0.1 -p 9008 -t 10000 -e 1");
  28. // prx3->tars_ping();
  29. // LOG_CONSOLE_DEBUG << "prx3 succ" << endl;
  30. // }
  31. // catch(exception &ex)
  32. // {
  33. // LOG_CONSOLE_DEBUG << ex.what() << endl;
  34. // }
  35. //
  36. //}
  37. TEST_F(HelloTest, sslSyncServerCommunicator)
  38. {
  39. transServerCommunicator([&](Communicator *comm){
  40. checkSync(comm, "SSLHelloAdapter");
  41. });
  42. }
  43. TEST_F(HelloTest, sslASyncServerCommunicatorInCoroutine)
  44. {
  45. transInCoroutineServerCommunicator([&](Communicator *comm){
  46. checkASync(comm, "SSLHelloAdapter");
  47. });
  48. }
  49. TEST_F(HelloTest, ssl1SyncServerCommunicator)
  50. {
  51. transServerCommunicator([&](Communicator *comm){
  52. checkSync(comm, "SSLHello1Adapter");
  53. });
  54. }
  55. TEST_F(HelloTest, ssl1ASyncServerCommunicatorInCoroutine)
  56. {
  57. transInCoroutineServerCommunicator([&](Communicator *comm){
  58. checkASync(comm, "SSLHello1Adapter");
  59. });
  60. }
  61. TEST_F(HelloTest, ssl2SyncServerCommunicator)
  62. {
  63. transServerCommunicator([&](Communicator *comm){
  64. checkSync(comm, "SSLHello2Adapter");
  65. });
  66. }
  67. TEST_F(HelloTest, ssl2ASyncServerCommunicatorInCoroutine)
  68. {
  69. transInCoroutineServerCommunicator([&](Communicator *comm){
  70. checkASync(comm, "SSLHello2Adapter");
  71. });
  72. }
  73. TEST_F(HelloTest, ssl3SyncServerCommunicator)
  74. {
  75. transServerCommunicator([&](Communicator *comm){
  76. checkSync(comm, "SSLHello3Adapter");
  77. });
  78. }
  79. TEST_F(HelloTest, ssl3ASyncServerCommunicatorInCoroutine)
  80. {
  81. transInCoroutineServerCommunicator([&](Communicator *comm){
  82. checkASync(comm, "SSLHello3Adapter");
  83. });
  84. }
  85. #endif