com.paritytrading.nassau.soupbintcp.SoupBinTCP Java Examples

The following examples show how to use com.paritytrading.nassau.soupbintcp.SoupBinTCP. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Server.java    From nassau with Apache License 2.0 6 votes vote down vote up
private Session(SocketChannel channel) {
    transport = new SoupBinTCPServer(channel, this, new SoupBinTCPServerStatusListener() {

        @Override
        public void loginRequest(SoupBinTCPServer session, SoupBinTCP.LoginRequest message) {
        }

        @Override
        public void logoutRequest(SoupBinTCPServer session) {
        }

        @Override
        public void heartbeatTimeout(SoupBinTCPServer session) {
        }

    });
}
 
Example #2
Source File: TerminalClient.java    From parity with Apache License 2.0 6 votes vote down vote up
static TerminalClient open(InetSocketAddress address, String username,
        String password, Instruments instruments) throws IOException {
    Events events = new Events();

    OrderEntry orderEntry = OrderEntry.open(address, events);

    SoupBinTCP.LoginRequest loginRequest = new SoupBinTCP.LoginRequest();

    ASCII.putLeft(loginRequest.username, username);
    ASCII.putLeft(loginRequest.password, password);
    ASCII.putRight(loginRequest.requestedSession, "");
    ASCII.putLongRight(loginRequest.requestedSequenceNumber, 0);

    orderEntry.getTransport().login(loginRequest);

    return new TerminalClient(events, orderEntry, instruments);
}
 
Example #3
Source File: Session.java    From parity with Apache License 2.0 6 votes vote down vote up
@Override
public void loginRequest(SoupBinTCPServer session, SoupBinTCP.LoginRequest payload) {
    if (username != 0) {
        close();
        return;
    }

    loginAccepted.session        = payload.requestedSession;
    loginAccepted.sequenceNumber = payload.requestedSequenceNumber;

    try {
        transport.accept(loginAccepted);
    } catch (IOException e) {
        close();
    }

    username = ByteArrays.packLong(payload.username, SPACE);
}
 
Example #4
Source File: OrderEntry.java    From parity-extras with Apache License 2.0 5 votes vote down vote up
public void login(String username, String password) throws IOException {
    SoupBinTCP.LoginRequest request = new SoupBinTCP.LoginRequest();

    ASCII.putLeft(request.username, username);
    ASCII.putLeft(request.password, password);
    ASCII.putRight(request.requestedSession, "");
    ASCII.putLongRight(request.requestedSequenceNumber, 0);

    transport.login(request);
}
 
Example #5
Source File: Session.java    From nassau with Apache License 2.0 5 votes vote down vote up
@Override
public void loginRequest(SoupBinTCPServer session, SoupBinTCP.LoginRequest payload) throws IOException {
    loginAccepted.setSession(payload.requestedSession);
    loginAccepted.setSequenceNumber(1);

    downstream.accept(loginAccepted);
}
 
Example #6
Source File: Session.java    From parity with Apache License 2.0 5 votes vote down vote up
@Override
public void loginRejected(SoupBinTCPClient session, SoupBinTCP.LoginRejected payload) throws IOException {
    switch (payload.rejectReasonCode) {
    case SoupBinTCP.LOGIN_REJECT_CODE_NOT_AUTHORIZED:
        fix.sendLogout("Not authorized");
        break;
    case SoupBinTCP.LOGIN_REJECT_CODE_SESSION_NOT_AVAILABLE:
        fix.sendLogout("Session not available");
        break;
    }
}
 
Example #7
Source File: OrderEntry.java    From parity-extras with Apache License 2.0 4 votes vote down vote up
@Override
public void loginAccepted(SoupBinTCPClient session, SoupBinTCP.LoginAccepted payload) {
}
 
Example #8
Source File: OrderEntry.java    From parity-extras with Apache License 2.0 4 votes vote down vote up
@Override
public void loginRejected(SoupBinTCPClient session, SoupBinTCP.LoginRejected payload) {
    error("Login rejected");
}
 
Example #9
Source File: OrderEntry.java    From parity with Apache License 2.0 4 votes vote down vote up
@Override
public void loginAccepted(SoupBinTCPClient session, SoupBinTCP.LoginAccepted payload) {
}
 
Example #10
Source File: OrderEntry.java    From parity with Apache License 2.0 4 votes vote down vote up
@Override
public void loginRejected(SoupBinTCPClient session, SoupBinTCP.LoginRejected payload) {
    close();
}
 
Example #11
Source File: Session.java    From parity with Apache License 2.0 4 votes vote down vote up
@Override
public void loginAccepted(SoupBinTCPClient session, SoupBinTCP.LoginAccepted payload) throws IOException {
    fix.sendLogon(false);
}