All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bt.tracker.udp.ConnectResponseHandler Maven / Gradle / Ivy

There is a newer version: 1.10
Show newest version
package bt.tracker.udp;

import bt.BtException;
import bt.protocol.Protocols;

class ConnectResponseHandler implements UdpTrackerResponseHandler {

    private static final ConnectResponseHandler instance = new ConnectResponseHandler();

    public static ConnectResponseHandler handler() {
        return instance;
    }

    @Override
    public Session onSuccess(byte[] data) {
        return new Session(Protocols.readLong(data, 0));
    }

    @Override
    public Session onError(String message) {
        throw new BtException("Tracker returned error for connect request: " + message);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy