aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/main/java/me/lucko/spark/common/util
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2023-03-07 21:54:14 +0000
committerLuck <git@lucko.me>2023-03-07 21:54:14 +0000
commit0f30d2983ec6ef487fd1966c1c22fa4a73e081f9 (patch)
treed719c1994e359fbe5387eef8ad74def15e9044e2 /spark-common/src/main/java/me/lucko/spark/common/util
parentd61aa1f95e8c9afaf55bb00d869782025efcd953 (diff)
downloadspark-0f30d2983ec6ef487fd1966c1c22fa4a73e081f9.tar.gz
spark-0f30d2983ec6ef487fd1966c1c22fa4a73e081f9.tar.bz2
spark-0f30d2983ec6ef487fd1966c1c22fa4a73e081f9.zip
Don't use multi-release jar for websocket code
Diffstat (limited to 'spark-common/src/main/java/me/lucko/spark/common/util')
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/util/ws/BytesocksClient.java118
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/util/ws/BytesocksClientImpl.java40
2 files changed, 0 insertions, 158 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/ws/BytesocksClient.java b/spark-common/src/main/java/me/lucko/spark/common/util/ws/BytesocksClient.java
deleted file mode 100644
index 1db7a67..0000000
--- a/spark-common/src/main/java/me/lucko/spark/common/util/ws/BytesocksClient.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * This file is part of spark.
- *
- * Copyright (c) lucko (Luck) <luck@lucko.me>
- * Copyright (c) contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package me.lucko.spark.common.util.ws;
-
-import java.util.concurrent.CompletableFuture;
-
-/**
- * A client that can interact with bytesocks.
- *
- * @see <a href="https://github.com/lucko/bytesocks">https://github.com/lucko/bytesocks</a>
- */
-public interface BytesocksClient {
-
- /**
- * Creates a new {@link BytesocksClient}.
- *
- * <p>Returns {@code null} on Java versions before 11.</p>
- *
- * @param host the host
- * @param userAgent the user agent
- * @return the client
- */
- static BytesocksClient create(String host, String userAgent) {
- try {
- return new BytesocksClientImpl(host, userAgent);
- } catch (UnsupportedOperationException e) {
- return null;
- }
- }
-
- /**
- * Creates a new bytesocks channel and returns a socket connected to it.
- *
- * @param listener the listener
- * @return the socket
- * @throws Exception if something goes wrong
- */
- Socket createAndConnect(Listener listener) throws Exception;
-
- /**
- * Connects to an existing bytesocks channel.
- *
- * @param channelId the channel id
- * @param listener the listener
- * @return the socket
- * @throws Exception if something goes wrong
- */
- Socket connect(String channelId, Listener listener) throws Exception;
-
- /**
- * A socket connected to a bytesocks channel.
- */
- interface Socket {
-
- /**
- * Gets the id of the connected channel.
- *
- * @return the id of the channel
- */
- String getChannelId();
-
- /**
- * Gets if the socket is open.
- *
- * @return true if the socket is open
- */
- boolean isOpen();
-
- /**
- * Sends a message to the channel using the socket.
- *
- * @param msg the message to send
- * @return a future to encapsulate the progress of sending the message
- */
- CompletableFuture<?> send(CharSequence msg);
-
- /**
- * Closes the socket.
- *
- * @param statusCode the status code
- * @param reason the reason
- */
- void close(int statusCode, String reason);
- }
-
- /**
- * Socket listener
- */
- interface Listener {
-
- default void onOpen() {}
-
- default void onError(Throwable error) {}
-
- default void onText(CharSequence data) {}
-
- default void onClose(int statusCode, String reason) {}
- }
-
-}
diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/ws/BytesocksClientImpl.java b/spark-common/src/main/java/me/lucko/spark/common/util/ws/BytesocksClientImpl.java
deleted file mode 100644
index cf1489c..0000000
--- a/spark-common/src/main/java/me/lucko/spark/common/util/ws/BytesocksClientImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of spark.
- *
- * Copyright (c) lucko (Luck) <luck@lucko.me>
- * Copyright (c) contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package me.lucko.spark.common.util.ws;
-
-// Overridden by java 11 source set
-
-class BytesocksClientImpl implements BytesocksClient {
-
- BytesocksClientImpl(String host, String userAgent) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Socket createAndConnect(Listener listener) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Socket connect(String channelId, Listener listener) throws Exception {
- throw new UnsupportedOperationException();
- }
-}