Skip to content

Commit 4a47806

Browse files
Adding double check.
1 parent cdff9a0 commit 4a47806

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

client/src/main/java/io/split/engine/sse/client/SSEClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ private enum ConnectionState {
4343
private final static String KEEP_ALIVE_PAYLOAD = ":keepalive\n";
4444
private final static long CONNECT_TIMEOUT = 30000;
4545
private static final Logger _log = LoggerFactory.getLogger(SSEClient.class);
46+
private static final String CONNECTION_OK = "OK";
4647

4748
private final ExecutorService _connectionExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder()
4849
.setDaemon(true)
@@ -153,7 +154,8 @@ private boolean establishConnection(URI uri, CountDownLatch signal) {
153154

154155
try {
155156
_ongoingResponse.set(_client.execute(_ongoingRequest.get()));
156-
if (_ongoingResponse.get().getCode() != 200) {
157+
if (_ongoingResponse.get().getCode() != 200 ||
158+
(_ongoingResponse.get().getCode() == 200 && !CONNECTION_OK.equals(_ongoingResponse.get().getReasonPhrase()))) {
157159
return false;
158160
}
159161
_state.set(ConnectionState.OPEN);

0 commit comments

Comments
 (0)