Java Code Examples for com.alipay.remoting.rpc.RpcClient#init()
The following examples show how to use
com.alipay.remoting.rpc.RpcClient#init() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeartBeatDisableTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.TCP_IDLE, "100"); System.setProperty(Configs.TCP_SERVER_IDLE, "50"); System.setProperty(Configs.TCP_IDLE_SWITCH, Boolean.toString(false)); server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 2
Source File: BasicUsageTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { ProtocolManager.unRegisterProtocol(RpcProtocolV2.PROTOCOL_CODE); server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 3
Source File: ScheduledDisconnectStrategyTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
private void doInit(boolean enableSystem, boolean enableUser) { if (enableSystem) { System.setProperty(Configs.CONN_MONITOR_SWITCH, "true"); System.setProperty(Configs.CONN_RECONNECT_SWITCH, "true"); } else { System.setProperty(Configs.CONN_MONITOR_SWITCH, "false"); System.setProperty(Configs.CONN_RECONNECT_SWITCH, "false"); } server = new BoltServer(port, false, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); if (enableUser) { client.enableReconnectSwitch(); client.enableConnectionMonitorSwitch(); } client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 4
Source File: WaterMarkTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.NETTY_BUFFER_HIGH_WATERMARK, Integer.toString(128 * 1024)); System.setProperty(Configs.NETTY_BUFFER_LOW_WATERMARK, Integer.toString(32 * 1024)); server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 5
Source File: WaterMark_UserProperty_ExceptionTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { server = new BoltServer(port, true); server.getRpcServer().initWriteBufferWaterMark(1, 2); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.initWriteBufferWaterMark(1, 2); client.init(); }
Example 6
Source File: WaterMark_SystemProperty_ExceptionTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.NETTY_BUFFER_HIGH_WATERMARK, Integer.toString(2)); System.setProperty(Configs.NETTY_BUFFER_LOW_WATERMARK, Integer.toString(1)); server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 7
Source File: BasicUsage_ExecutorSelector_Test.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); serverUserProcessor.setExecutorSelector(this.selector0); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); clientUserProcessor.setExecutorSelector(this.selector1); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 8
Source File: ConnectionTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() throws Exception { server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor);// no use here client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor);// no use here client.init(); Thread.sleep(100); }
Example 9
Source File: BasicUsage_AsyncProcessor_Exception_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 10
Source File: ServerInvokeExceptionTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 11
Source File: BasicUsage_MultiInterestUserProcessorTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 12
Source File: CreateConnLockTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { whetherConnectTimeoutConsumedTooLong.set(false); server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 13
Source File: CustomSerializerCodecTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 14
Source File: BasicUsage_InvokeContext_Url_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 15
Source File: ClientConnectionTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 16
Source File: BasicUsage_InvokeContext_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 17
Source File: RpcClientDemoByMain.java From sofa-bolt with Apache License 2.0 | 5 votes |
public RpcClientDemoByMain() { // 1. create a rpc client client = new RpcClient(); // 2. add processor for connect and close event if you need client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); // 3. do init client.init(); }
Example 18
Source File: CodecTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 19
Source File: BasicUsage_ProcessInIoThread_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example 20
Source File: ClassCustomSerializerTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }