18
18
19
19
package org .jpos .iso .channel ;
20
20
21
+ import org .jpos .core .Configuration ;
22
+ import org .jpos .core .ConfigurationException ;
21
23
import org .jpos .iso .*;
22
24
import org .jpos .util .LogEvent ;
23
25
import org .jpos .util .Logger ;
40
42
*/
41
43
public class PADChannel extends BaseChannel {
42
44
BufferedReader reader = null ;
45
+ long delay = 0L ;
43
46
/**
44
47
* No-args constructor
45
48
*/
@@ -76,7 +79,10 @@ public PADChannel (ISOPackager p, ServerSocket serverSocket)
76
79
throws IOException
77
80
{
78
81
super (p , serverSocket );
82
+ if (delay > 0L )
83
+ ISOUtil .sleep (delay );
79
84
}
85
+ @ Override
80
86
public ISOMsg receive () throws IOException , ISOException {
81
87
byte [] header = null ;
82
88
ISOMsg m = new ISOMsg ();
@@ -85,7 +91,7 @@ public ISOMsg receive() throws IOException, ISOException {
85
91
int hLen = getHeaderLength ();
86
92
LogEvent evt = new LogEvent (this , "receive" );
87
93
try {
88
- synchronized (serverIn ) {
94
+ synchronized (serverInLock ) {
89
95
if (hLen > 0 ) {
90
96
header = new byte [hLen ];
91
97
serverIn .readFully (header );
@@ -122,6 +128,16 @@ public ISOMsg receive() throws IOException, ISOException {
122
128
Logger .log (evt );
123
129
return m ;
124
130
}
131
+ @ Override
132
+ public void send (ISOMsg m ) throws IOException , ISOException {
133
+ super .send (m );
134
+ }
135
+ @ Override
136
+ public void setConfiguration (Configuration cfg )
137
+ throws ConfigurationException {
138
+ super .setConfiguration (cfg );
139
+ delay = cfg .getLong ("delay" , 0L );
140
+ }
125
141
126
142
/**
127
143
* @param header Hex representation of header
0 commit comments