@@ -44,7 +44,7 @@ public class FakeCentralSystem
4444 private Confirmation receivedConfirmation ;
4545 private Server server ;
4646
47- private int sessionIndex ;
47+ private int currentSessionIndex ;
4848
4949 private static FakeCentralSystem instance ;
5050 private boolean isRigged ;
@@ -172,24 +172,27 @@ public StopTransactionConfirmation handleStopTransactionRequest(int sessionIndex
172172 }
173173 });
174174
175+ int port = 0 ;
175176 switch (type ) {
176177 case JSON :
177178 server = new JSONServer (serverCoreProfile );
179+ port = 8887 ;
178180 break ;
179181 case SOAP :
180182 server = new SOAPServer (serverCoreProfile );
183+ port = 8890 ;
181184 break ;
182185 }
183186
184- server .open ("localhost" , 8887 , new ServerEvents () {
187+ server .open ("localhost" , port , new ServerEvents () {
185188 @ Override
186189 public void newSession (int sessionIndex ) {
187- FakeCentralSystem . this . sessionIndex = sessionIndex ;
190+ currentSessionIndex = sessionIndex ;
188191 }
189192
190193 @ Override
191194 public void lostSession (int identity ) {
192- sessionIndex = -1 ;
195+ currentSessionIndex = -1 ;
193196 // clear
194197 receivedConfirmation = null ;
195198 receivedRequest = null ;
@@ -219,7 +222,7 @@ public void sendChangeAvailabilityRequest(int connectorId, AvailabilityType type
219222 ChangeAvailabilityRequest request = new ChangeAvailabilityRequest ();
220223 request .setType (type );
221224 request .setConnectorId (connectorId );
222- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
225+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
223226
224227 }
225228
@@ -234,7 +237,7 @@ public void sendChangeConfigurationRequest(String key, String value) throws Exce
234237 ChangeConfigurationRequest request = new ChangeConfigurationRequest ();
235238 request .setKey (key );
236239 request .setValue (value );
237- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
240+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
238241 }
239242
240243 public boolean hasReceivedChangeConfigurationConfirmation () {
@@ -243,7 +246,7 @@ public boolean hasReceivedChangeConfigurationConfirmation() {
243246
244247 public void sendClearCacheRequest () throws Exception {
245248 ClearCacheRequest request = new ClearCacheRequest ();
246- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
249+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
247250 }
248251
249252 public boolean hasReceivedClearCacheConfirmation () {
@@ -255,7 +258,7 @@ public void sendDataTransferRequest(String vendorId, String messageId, String da
255258 request .setVendorId (vendorId );
256259 request .setMessageId (messageId );
257260 request .setData (data );
258- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
261+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
259262 }
260263
261264 public boolean hasReceivedDataTransferConfirmation () {
@@ -269,7 +272,7 @@ public boolean hasHandledDataTransferRequest() {
269272 public void sendGetConfigurationRequest (String ... key ) throws Exception {
270273 GetConfigurationRequest request = new GetConfigurationRequest ();
271274 request .setKey (key );
272- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
275+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
273276 }
274277
275278 public boolean hasReceivedGetConfigurationConfirmation () {
@@ -290,7 +293,7 @@ public void sendRemoteStartTransactionRequest(int connectorId, String idTag) thr
290293 idToken .setIdToken (idTag );
291294 request .setIdTag (idToken );
292295 request .setConnectorId (connectorId );
293- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
296+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
294297 }
295298
296299 public boolean hasReceivedRemoteStartTransactionConfirmation (String status ) {
@@ -303,7 +306,7 @@ public boolean hasReceivedRemoteStartTransactionConfirmation(String status) {
303306 public void sendRemoteStopTransactionRequest (int transactionId ) throws Exception {
304307 RemoteStopTransactionRequest request = new RemoteStopTransactionRequest ();
305308 request .setTransactionId (transactionId );
306- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
309+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
307310 }
308311
309312 public boolean hasReceivedRemoteStopTransactionConfirmation (String status ) {
@@ -316,7 +319,7 @@ public boolean hasReceivedRemoteStopTransactionConfirmation(String status) {
316319 public void sendResetRequest (ResetType type ) throws Exception {
317320 ResetRequest request = new ResetRequest ();
318321 request .setType (type );
319- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
322+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
320323 }
321324
322325 public boolean hasReceivedResetConfirmation (String status ) {
@@ -341,7 +344,7 @@ public boolean hasHandledStopTransactionRequest() {
341344 public void sendUnlockConnectorRequest (int connectorId ) throws Exception {
342345 UnlockConnectorRequest request = new UnlockConnectorRequest ();
343346 request .setConnectorId (connectorId );
344- server .send (sessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
347+ server .send (currentSessionIndex , request ).whenComplete ((confirmation , throwable ) -> receivedConfirmation = confirmation );
345348 }
346349
347350 public boolean hasReceivedUnlockConnectorConfirmation (String status ) {
0 commit comments