diff --git a/src/net/sharksystem/asap/internals/ASAPConnectionHandler.java b/src/net/sharksystem/asap/ASAPConnectionHandler.java similarity index 89% rename from src/net/sharksystem/asap/internals/ASAPConnectionHandler.java rename to src/net/sharksystem/asap/ASAPConnectionHandler.java index 824e28e..3f5e5e8 100644 --- a/src/net/sharksystem/asap/internals/ASAPConnectionHandler.java +++ b/src/net/sharksystem/asap/ASAPConnectionHandler.java @@ -1,4 +1,4 @@ -package net.sharksystem.asap.internals; +package net.sharksystem.asap; import net.sharksystem.asap.ASAPException; import net.sharksystem.asap.protocol.ASAPConnection; diff --git a/src/net/sharksystem/asap/ASAPInternalPeerWrapper.java b/src/net/sharksystem/asap/ASAPInternalPeerWrapper.java index 52304df..65d7ec1 100644 --- a/src/net/sharksystem/asap/ASAPInternalPeerWrapper.java +++ b/src/net/sharksystem/asap/ASAPInternalPeerWrapper.java @@ -2,6 +2,7 @@ import net.sharksystem.asap.internals.ASAPInternalOnlinePeersChangedListener; import net.sharksystem.asap.internals.ASAPInternalPeer; +import net.sharksystem.asap.protocol.ASAPConnection; import java.io.IOException; import java.io.InputStream; @@ -29,8 +30,8 @@ public CharSequence getPeerName() { return this.peer.getOwner(); } - public void handleConnection(InputStream is, OutputStream os) throws IOException, ASAPException { - this.peer.handleConnection(is, os); + public ASAPConnection handleConnection(InputStream is, OutputStream os) throws IOException, ASAPException { + return this.peer.handleConnection(is, os); } @Override diff --git a/src/net/sharksystem/asap/ASAPPeerService.java b/src/net/sharksystem/asap/ASAPPeerService.java index 29ec137..369bd4b 100644 --- a/src/net/sharksystem/asap/ASAPPeerService.java +++ b/src/net/sharksystem/asap/ASAPPeerService.java @@ -7,10 +7,9 @@ import java.io.InputStream; import java.io.OutputStream; -public interface ASAPPeerService extends ASAPPeer { - long DEFAULT_MAX_PROCESSING_TIME = ASAPInternalPeer.DEFAULT_MAX_PROCESSING_TIME; - - void handleConnection(InputStream is, OutputStream os) throws IOException, ASAPException; +public interface ASAPPeerService extends ASAPPeer, ASAPConnectionHandler { + // long DEFAULT_MAX_PROCESSING_TIME = 30000; // 30 seconds + long DEFAULT_MAX_PROCESSING_TIME = Long.MAX_VALUE; // eternity - debugging setting /** * Overwrite internal listener. This method is used e.g. in Androiud on service side. The asap peer is informed diff --git a/src/net/sharksystem/asap/apps/testsupport/ASAPPeerWrapperMock.java b/src/net/sharksystem/asap/apps/testsupport/ASAPPeerWrapperMock.java index 2283dc4..0e7b57d 100644 --- a/src/net/sharksystem/asap/apps/testsupport/ASAPPeerWrapperMock.java +++ b/src/net/sharksystem/asap/apps/testsupport/ASAPPeerWrapperMock.java @@ -6,6 +6,7 @@ import net.sharksystem.asap.internals.ASAPChunkReceivedListener; import net.sharksystem.asap.ASAPException; import net.sharksystem.asap.internals.ASAPMessages; +import net.sharksystem.asap.protocol.ASAPConnection; import java.io.IOException; import java.io.InputStream; @@ -125,7 +126,7 @@ public CharSequence getPeerName() { } @Override - public void handleConnection(InputStream is, OutputStream os) throws IOException, ASAPException { + public ASAPConnection handleConnection(InputStream is, OutputStream os) throws IOException, ASAPException { throw new ASAPException("that's a mock, no real peer"); } diff --git a/src/net/sharksystem/asap/internals/ASAPInternalPeer.java b/src/net/sharksystem/asap/internals/ASAPInternalPeer.java index 37640e4..ff882b7 100644 --- a/src/net/sharksystem/asap/internals/ASAPInternalPeer.java +++ b/src/net/sharksystem/asap/internals/ASAPInternalPeer.java @@ -1,5 +1,6 @@ package net.sharksystem.asap.internals; +import net.sharksystem.asap.ASAPConnectionHandler; import net.sharksystem.asap.ASAPException; import net.sharksystem.asap.ASAPSecurityException; import net.sharksystem.asap.protocol.*; diff --git a/src/net/sharksystem/asap/util/ASAPPeerHandleConnectionThread.java b/src/net/sharksystem/asap/util/ASAPPeerHandleConnectionThread.java index aedaf99..cf1818c 100644 --- a/src/net/sharksystem/asap/util/ASAPPeerHandleConnectionThread.java +++ b/src/net/sharksystem/asap/util/ASAPPeerHandleConnectionThread.java @@ -4,7 +4,7 @@ import java.io.InputStream; import java.io.OutputStream; -import net.sharksystem.asap.internals.ASAPConnectionHandler; +import net.sharksystem.asap.ASAPConnectionHandler; import net.sharksystem.asap.ASAPException; /**