17
17
package org .apache .dubbo .rpc .protocol .tri ;
18
18
19
19
import org .apache .dubbo .common .URL ;
20
+ import org .apache .dubbo .common .extension .ExtensionLoader ;
20
21
import org .apache .dubbo .common .stream .StreamObserver ;
21
22
import org .apache .dubbo .common .utils .ClassUtils ;
22
23
import org .apache .dubbo .common .utils .NetUtils ;
33
34
import org .apache .dubbo .rpc .protocol .tri .support .IGreeter ;
34
35
import org .apache .dubbo .rpc .protocol .tri .support .IGreeterImpl ;
35
36
import org .apache .dubbo .rpc .protocol .tri .support .MockStreamObserver ;
37
+ import org .apache .dubbo .rpc .service .EchoService ;
36
38
37
39
import java .util .concurrent .TimeUnit ;
38
40
39
41
import org .junit .jupiter .api .Assertions ;
40
42
import org .junit .jupiter .api .Test ;
41
43
42
44
import static org .apache .dubbo .rpc .protocol .tri .support .IGreeter .SERVER_MSG ;
45
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
43
46
44
47
class TripleProtocolTest {
45
48
@@ -65,7 +68,8 @@ void testDemoProtocol() throws Exception {
65
68
serviceRepository .registerProvider (providerModel );
66
69
providerUrl = providerUrl .setServiceModel (providerModel );
67
70
68
- Protocol protocol = new TripleProtocol (providerUrl .getOrDefaultFrameworkModel ());
71
+ Protocol protocol = ExtensionLoader .getExtensionLoader (Protocol .class ).getExtension ("tri" );
72
+
69
73
ProxyFactory proxy =
70
74
applicationModel .getExtensionLoader (ProxyFactory .class ).getAdaptiveExtension ();
71
75
Invoker <IGreeter > invoker = proxy .getInvoker (serviceImpl , IGreeter .class , providerUrl );
@@ -107,6 +111,11 @@ void testDemoProtocol() throws Exception {
107
111
Assertions .assertEquals (REQUEST_MSG , serverOutboundMessageSubscriber .getOnNextData ());
108
112
Assertions .assertTrue (serverOutboundMessageSubscriber .isOnCompleted ());
109
113
114
+ EchoService echo = proxy .getProxy (protocol .refer (EchoService .class , consumerUrl ));
115
+ assertEquals (echo .$echo ("test" ), "test" );
116
+ assertEquals (echo .$echo ("abcdefg" ), "abcdefg" );
117
+ assertEquals (echo .$echo (1234 ), 1234 );
118
+
110
119
export .unexport ();
111
120
protocol .destroy ();
112
121
// resource recycle.
0 commit comments