refactoring
This commit is contained in:
parent
1babfebdcd
commit
a636bff294
|
@ -27,11 +27,6 @@ public interface LinkConnector extends LinkDecoder {
|
||||||
public String unpack(String packet) {
|
public String unpack(String packet) {
|
||||||
return LinkDecoder.TEXT_PROTOCOL_DECODER.unpack(packet);
|
return LinkDecoder.TEXT_PROTOCOL_DECODER.unpack(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String unpackConfirmation(String message) {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void connect(ConnectionStateListener listener);
|
void connect(ConnectionStateListener listener);
|
||||||
|
@ -41,6 +36,4 @@ public interface LinkConnector extends LinkDecoder {
|
||||||
void restart();
|
void restart();
|
||||||
|
|
||||||
boolean hasError();
|
boolean hasError();
|
||||||
|
|
||||||
String unpackConfirmation(String message);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,8 @@ public class LinkManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String unpackConfirmation(String message) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,13 +148,6 @@ public class TcpConnector implements LinkConnector {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@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() {
|
public static Collection<String> getAvailablePorts() {
|
||||||
return isTcpPortOpened() ? Collections.singletonList("" + DEFAULT_PORT) : Collections.<String>emptyList();
|
return isTcpPortOpened() ? Collections.singletonList("" + DEFAULT_PORT) : Collections.<String>emptyList();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue