File tree 1 file changed +15
-5
lines changed
java/client/src/org/openqa/selenium/firefox/internal
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -326,17 +326,27 @@ private String receiveResponse() throws IOException {
326
326
char [] buf = new char [1024 ];
327
327
int len = reader .read (buf );
328
328
response .append (buf , 0 , len );
329
- while (len >= 1024 ) {
329
+
330
+ String [] parts = response .toString ().split (":" , 2 );
331
+ int contentLength = Integer .parseInt (parts [0 ]);
332
+
333
+ while (response .length () < contentLength + ":" .length () + parts [0 ].length ()) {
330
334
buf = new char [1024 ];
331
335
len = reader .read (buf );
332
- response .append (buf , 0 , len );
336
+ if (len > 0 ) {
337
+ response .append (buf , 0 , len );
338
+ } else {
339
+ try {
340
+ Thread .sleep (100 );
341
+ } catch (InterruptedException e ) {
342
+ }
343
+ }
333
344
}
334
345
335
346
System .out .println ("<- |" + response .toString () + "|" );
336
347
337
- String [] parts = response .toString ().split (":" , 2 );
338
- int length = Integer .parseInt (parts [0 ]);
339
- return parts [1 ].substring (0 , length );
348
+ parts = response .toString ().split (":" , 2 );
349
+ return parts [1 ].substring (0 , contentLength );
340
350
}
341
351
342
352
public void quit () {
You can’t perform that action at this time.
0 commit comments