refactoring
This commit is contained in:
parent
f67dbce2cc
commit
122cb21e98
|
@ -27,11 +27,6 @@ public interface LinkConnector extends LinkDecoder {
|
|||
public String unpack(String packet) {
|
||||
return LinkDecoder.TEXT_PROTOCOL_DECODER.unpack(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unpackConfirmation(String message) {
|
||||
return message;
|
||||
}
|
||||
};
|
||||
|
||||
void connect(ConnectionStateListener listener);
|
||||
|
@ -41,6 +36,4 @@ public interface LinkConnector extends LinkDecoder {
|
|||
void restart();
|
||||
|
||||
boolean hasError();
|
||||
|
||||
String unpackConfirmation(String message);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,8 @@ public class LinkManager {
|
|||
}
|
||||
|
||||
public static String unpackConfirmation(String message) {
|
||||
return connector.unpackConfirmation(message);
|
||||
if (message.startsWith(CommandQueue.CONFIRMATION_PREFIX))
|
||||
return message.substring(CommandQueue.CONFIRMATION_PREFIX.length());
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,14 +147,7 @@ public class TcpConnector implements LinkConnector {
|
|||
// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unpackConfirmation(String message) {
|
||||
if (message.startsWith(CommandQueue.CONFIRMATION_PREFIX))
|
||||
return message.substring(CommandQueue.CONFIRMATION_PREFIX.length());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static Collection<String> getAvailablePorts() {
|
||||
return isTcpPortOpened() ? Collections.singletonList("" + DEFAULT_PORT) : Collections.<String>emptyList();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue